/**
 * NWM Journal Frontend Styles - v2.0.0
 */

.nwm-journal-issue-container {
    margin: 20px 0;
}

.nwm-journal-issue {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Issue Header */
.nwm-issue-header-container {
    margin-top: 90px;
    display: flex;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 30px;
}

.nwm-issue-left {
    flex: 1;
}

.nwm-journal-title {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 15px !important;
    margin-top: 0 !important;
}

.nwm-issue-meta {
    margin: 0;
}

.nwm-issue-date,
.nwm-issue-editor,
.nwm-issue-authors,
.nwm-section-authors {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 1.1em;
    line-height: 1.4;
}

.nwm-section-authors {
    margin-left: 20px;
    font-size: 0.95em;
    color: #666;
    font-style: italic;
}

.nwm-section-authors strong {
    font-style: normal;
    color: #333;
}

.nwm-section-title-authors {
    margin: 8px 0 4px 0;
    color: #333;
    font-size: 1.05em;
    font-weight: 600;
}

/* Header Section Links */
.nwm-header-section-link {
    text-decoration: none;
    color: #e72d48;
    transition: color 0.3s ease;
    cursor: pointer;
}

.nwm-header-section-link:hover {
    color: #040228;
    text-decoration: underline;
}

.nwm-header-section-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 3px;
}

.nwm-section-title-authors:first-of-type {
    margin-top: 15px;
}

.nwm-issue-authors:last-child,
.nwm-section-authors:last-child {
    margin-bottom: 0;
}

.nwm-issue-cover-header {
    flex: 0 0 280px;
    margin-top: 120px;
    padding: 10px;
}

.nwm-header-cover-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: -o-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: bicubic;
    display: block;
}

.nwm-journal-title .nwm-year-badge {
    background: #040228 !important;
    color: white !important;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.nwm-journal-title .nwm-number-badge {
    background: #e72d48 !important;
    color: white !important;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

/* DRAFT Watermark - Diagonal Center */
.nwm-draft-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 120px;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.08);
    text-transform: uppercase;
    letter-spacing: 20px;
    pointer-events: none;
    z-index: 1000;
    user-select: none;
    white-space: nowrap;
}

.nwm-draft-watermark span {
    display: block;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* Layout container for desktop */
.nwm-journal-layout {
    display: flex;
    gap: 30px;
    margin: 40px 0;
}

.nwm-journal-main {
    flex: 1;
    min-width: 0; /* Prevents flex item from overflowing */
}

.nwm-journal-sidebar {
    flex: 0 0 300px; /* Fixed width sidebar */
    order: 2; /* Appears on the right */
}

.nwm-issue-cover {
    text-align: center;
    margin: 0;
    position: sticky;
    top: 20px; /* Sticky positioning */
}

.nwm-cover-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nwm-issue-date {
    margin: 0;
    color: #666;
    font-size: 1.1em;
}

/* Journal Content */
.nwm-journal-content {
    margin: 40px 0;
}

.nwm-journal-container {
    margin: 20px 0;
}

.nwm-journal-section {
    margin-bottom: 30px;
}

.nwm-section-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #ddd;
    color: #e72d48;
}


/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Add slight padding top for sections to account for header when scrolling */
.nwm-journal-section {
    scroll-margin-top: 20px;
}

/* Sidebar Styles */
.nwm-sidebar-section {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.nwm-sidebar-title {
    color: #040228;
    font-size: 1.5em;
    font-weight: bold;
    margin: 0 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #040228;
}

.nwm-issues-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.nwm-issue-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nwm-issue-item:hover {
    transform: translateY(-2px);
}

.nwm-issue-link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.nwm-issue-link:hover {
    background: #f5f5f5;
    border-color: #040228;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(4, 2, 40, 0.1);
}

.nwm-issue-thumbnail {
    flex: 0 0 60px;
}

.nwm-issue-cover-thumb {
    width: 60px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nwm-issue-info {
    flex: 1;
    min-width: 0;
}

.nwm-issue-title-sidebar {
    font-size: 0.9em;
    font-weight: 600;
    color: #040228;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.nwm-issue-date-sidebar {
    font-size: 0.8em;
    color: #666;
    margin: 0;
    font-style: italic;
}

.nwm-articles-list {
    list-style: none;
    padding: 0;
}

.nwm-article-item {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-left: 4px solid #040228;
    transition: all 0.3s ease;
}

.nwm-article-item:hover {
    background: #f5f5f5;
    transform: translateX(5px);
}

.nwm-article-title {
    margin: 0 0 8px 0;
    font-size: 1.2em;
    font-weight: 600;
    line-height: 1.3;
}

.nwm-article-title.nwm-has-video {
    cursor: pointer;
    color: #040228;
    transition: color 0.3s ease;
}

.nwm-article-title.nwm-has-video:hover {
    color: #040228;
    text-decoration: underline;
}

.nwm-article-title.clickable {
    cursor: pointer;
    color: #007cba;
    transition: color 0.3s ease;
}

.nwm-article-title.clickable:hover {
    color: #005a87;
    text-decoration: underline;
}

.nwm-article-title.clickable:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.nwm-article-title a {
    text-decoration: none;
    color: inherit;
}

.nwm-article-title a:hover {
    text-decoration: underline;
}

.video-icon,
.nwm-video-icon {
    margin-left: 8px;
    font-size: 0.8em;
    color: #666;
    background: #f0f0f0;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.nwm-article-title.nwm-has-video:hover .nwm-video-icon {
    background: #e72d48;
    color: white;
}

.nwm-article-authors {
    margin: 0;
    font-size: 0.95em;
    color: #666;
    font-style: italic;
}

.nwm-article-authors strong {
    font-style: normal;
    color: #333;
}

.nwm-no-articles {
    color: #999;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

/* Video popup/modal styles */
.nwm-video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.nwm-video-modal.active {
    display: flex;
}

.nwm-video-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: white;
    padding: 20px;
    border-radius: 8px;
}


.nwm-video-modal-body {
    position: relative;
}

.presto-player-container {
    width: 100%;
    max-width: 800px;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Switch to vertical layout on mobile */
    .nwm-journal-layout {
        flex-direction: column;
        gap: 20px;
    }

    .nwm-journal-sidebar {
        flex: none;
        order: -1; /* Cover appears above content on mobile */
    }

    .nwm-issue-cover {
        position: static; /* Remove sticky positioning on mobile */
        margin: 20px 0;
    }

    .nwm-article-item {
        margin-bottom: 15px;
        padding: 12px;
    }

    .nwm-article-title {
        font-size: 1.1em;
    }

    /* Header layout for mobile */
    .nwm-issue-header-container {
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
    }

    .nwm-issue-left {
        display: flex;
        flex-direction: column;
    }

    .nwm-journal-title {
        order: 1; /* Title first */
    }

    .nwm-issue-meta {
        order: 3; /* Published on last */
    }

    .nwm-issue-cover-header {
        flex: none;
        text-align: center;
        order: 2; /* Cover in the middle */
        padding: 8px;
        max-width: 250px;
        margin: 0 auto;
    }

    .nwm-header-cover-image {
        width: 100%;
        max-width: none;
    }

    /* Make badges stack vertically on mobile */
    .nwm-journal-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nwm-journal-title .nwm-year-badge,
    .nwm-journal-title .nwm-number-badge {
        font-size: 0.8em;
        padding: 6px 12px;
    }

    /* Watermark responsive - smaller on mobile */
    .nwm-draft-watermark {
        font-size: 80px;
        letter-spacing: 10px;
    }

    .nwm-video-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        padding: 15px;
    }
}

/* Loading state */
.nwm-video-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.nwm-video-loading:after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* No Content State */
.nwm-no-content {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 40px 0;
}

.nwm-no-content p {
    font-size: 1.1em;
    margin: 0;
}

/* Post Navigation Styles */
.post-navigation {
    margin: 40px 0;
    padding: 30px 0;
    border-top: 2px solid #e72d48;
}

.nav-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.nav-previous,
.nav-next {
    flex: 1;
    max-width: 48%;
}

.nav-previous a,
.nav-next a {
    display: block;
    padding: 15px 20px;
    background: #f9f9f9;
    border: 2px solid #040228;
    border-radius: 8px;
    text-decoration: none;
    color: #040228;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.4;
}

.nav-previous a:hover,
.nav-next a:hover {
    background: #040228;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(4, 2, 40, 0.2);
}

.nav-previous a:focus,
.nav-next a:focus {
    outline: 2px solid #e72d48;
    outline-offset: 2px;
}

/* Single navigation item when only one exists */
.nav-links .nav-previous:only-child,
.nav-links .nav-next:only-child {
    max-width: 300px;
    margin: 0 auto;
}

/* Updated Video Modal Styles */
.nwm-video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.nwm-video-modal.active {
    display: flex;
}

.nwm-video-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.nwm-video-modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 5px;
    background: transparent;
    border-bottom: none;
    height: 40px;
    margin-bottom: 10px;
}

.nwm-video-modal-title {
    margin: 0;
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    flex: 1;
    padding-right: 20px;
}

.nwm-video-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
    color: #0f0c32 !important;
    line-height: 1;
}

.nwm-video-modal-close:hover {
    background: #0f0c32 !important;
    color: white !important;
}

.nwm-video-modal-body {
    padding: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 360px;
}

.nwm-video-modal-body iframe {
    max-width: 100%;
    max-height: 80vh;
    width: 1280px;
    height: 720px;
}

.nwm-video-modal-body p {
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin: 0;
}

/* Focus States */
.nwm-has-video:focus,
.nwm-article-title.clickable:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 3px;
}

.nwm-video-modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Responsive Video Modal */
@media (max-width: 768px) {
    .nwm-video-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }

    .nwm-video-modal-header {
        padding: 15px;
    }

    .nwm-video-modal-title {
        font-size: 1.1em;
        padding-right: 15px;
    }

    .nwm-video-modal-body iframe {
        width: 100%;
        height: 320px;
        max-height: 70vh;
    }

    .nwm-journal-issue {
        padding: 0 15px;
    }

    /* Sidebar responsive adjustments */
    .nwm-sidebar-section {
        padding: 15px;
    }

    .nwm-sidebar-title {
        font-size: 1.2em;
    }

    .nwm-issue-link {
        padding: 10px;
    }

    .nwm-issue-cover-thumb {
        width: 50px;
    }

    .nwm-issue-thumbnail {
        flex: 0 0 50px;
    }

    /* Navigation responsive */
    .post-navigation {
        margin: 30px 0;
        padding: 20px 0;
    }

    .nav-links {
        flex-direction: column;
        gap: 15px;
    }

    .nav-previous,
    .nav-next {
        max-width: 100%;
    }

    .nav-previous a,
    .nav-next a {
        padding: 12px 16px;
        font-size: 0.9em;
    }
}

/* Tabs Container - Layout per Affiliation e Abstract */
.nwm-tabs-container {
    margin-top: 10px;
}

.nwm-tabs-header {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Tab Toggle Button */
.nwm-tab-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none !important;
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95em;
    color: #666;
    font-style: italic;
    text-align: left;
}

.nwm-tab-toggle:hover {
    background: none !important;
    color: #333;
    border-bottom-color: #ddd;
}

.nwm-tab-toggle:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    border-radius: 2px;
    background: none !important;
}

.nwm-tab-toggle[aria-expanded="true"] {
    color: #333;
    border-bottom-color: #333;
}

.nwm-tab-label {
    font-weight: bold;
    font-style: normal;
    color: #333;
}

.nwm-tab-icon {
    display: inline-flex;
    align-items: center;
    font-size: 0.7em;
    line-height: 1;
    transition: transform 0.3s ease;
    color: #999;
}

/* Tab Content Area */
.nwm-tabs-content {
    width: 100%;
    margin-top: 8px;
}

.nwm-tab-panel {
    display: none;
    padding: 10px 0;
    width: 100%;
}

.nwm-tab-panel p {
    margin: 0;
    color: #666;
    font-size: 0.88em;
    line-height: 1.6;
    font-style: italic;
}

/* Responsive per tabs */
@media screen and (max-width: 480px) {
    .nwm-tabs-header {
        gap: 10px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .nwm-article-item,
    .nwm-article-title.clickable,
    .nwm-article-title.nwm-has-video,
    .nwm-video-modal-close {
        transition: none;
    }

    .nwm-article-item:hover {
        transform: none;
    }

    .nwm-video-loading:after {
        animation: none;
    }
}