/* Modal Overlay */
.post-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.post-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

/* Modal Container */
.post-modal__container {
    position: relative;
    max-width: 900px;
    max-height: 90vh;
    margin: 5vh auto;
    background: #fff;
    border-radius: 12px !important;
    z-index: 6;
    animation: slideUp 0.3s ease;
    scrollbar-gutter: stable;
    overflow-y: scroll;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

/* Chrome/Edge/Safari */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.5);
    background-clip: padding-box;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 940px) {
    .post-modal__container {
        margin: 2vh;
        max-width: calc(100% - 4vh);
        max-height: 96vh;
    }
}

/* Close Button */
.post-modal__close {
    position: sticky;
    top: 1rem;
    right: 1rem;
    float: right;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.post-modal__close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.post-modal__close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Modal Content */
.post-modal__content {
    padding: 0rem 2rem;
    clear: both;
}

@media (max-width: 640px) {
    .post-modal__content {
        padding: 0 1.5rem;
    }
}

/* Loading State */
.post-modal__loading {
    text-align: center;
    padding: 3rem;
}

.post-modal__spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Body */
.post-modal__image {
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
}

.post-modal__image img {
    width: 100%;
    height: auto;
    display: block;
}

.post-modal__header {
    margin-bottom: 2rem;
}

.post-modal__title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: #1a1a1a;
    line-height: 1.3;
}

@media (max-width: 640px) {
    .post-modal__title {
        font-size: 1.5rem;
    }
}

.post-modal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.post-modal__text {
    line-height: 1.8;
    color: #333;
    margin-bottom: 2rem;
}

.post-modal__text p {
    margin-bottom: 1rem;
}

.post-modal__text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Categories and Tags */
.post-modal__categories,
.post-modal__tags {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.post-modal__categories strong,
.post-modal__tags strong {
    color: #1a1a1a;
    margin-right: 0.5rem;
}

.post-modal__categories a,
.post-modal__tags a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-modal__categories a:hover,
.post-modal__tags a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Footer */
.post-modal__footer {
    padding-top: 2rem;
    border-top: 1px solid #e5e5e5;
    text-align: center;
}

.post-modal__permalink {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.post-modal__permalink:hover {
    background: #005177;
}

/* Error State */
.post-modal__error {
    text-align: center;
    color: #d63638;
    padding: 2rem;
}

/* Scrollbar Styling */
.post-modal__container::-webkit-scrollbar {
    width: 10px;
}

.post-modal__container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.post-modal__container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.post-modal__container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.post-modal__content {
    line-height: 1.8;
    color: #333;
    margin-bottom: 2rem;
}

/* Reset pro Gutenberg bloky v modalu */
.post-modal__content .wp-block-image {
    margin: 2rem 0;
}

.post-modal__content .wp-block-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-modal__content .wp-block-gallery {
    margin: 2rem 0;
}

.post-modal__content .wp-block-quote {
    border-left: 4px solid #0073aa;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
}

.post-modal__content .wp-block-code {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.post-modal__content .wp-block-columns {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

.post-modal__content .wp-block-column {
    flex: 1;
}

/* Responsive columns v modalu */
@media (max-width: 768px) {
    .post-modal__content .wp-block-columns {
        flex-direction: column;
    }
}


.post-modal__content iframe {
    max-width: 100%;
}


/* Separator */
.post-modal__content .wp-block-separator {
    border: none;
    border-top: 2px solid #e5e5e5;
    margin: 2rem 0;
}

/* Spacer */
.post-modal__content .wp-block-spacer {
    display: block;
}

/* Cover block */
.post-modal__content .wp-block-cover {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
}

/* Group a Container */
.post-modal__content .wp-block-group,
.post-modal__content .wp-block-container {
    margin: 2rem 0;
}

.post-modal__body .wp-block-post-featured-image img {
    object-fit: contain;
    width: 100%;
    height: 100%;
}