/* WMCT Email Inbox Styling */


.main-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(19, 53, 82, 0.4) 0%, rgba(11, 15, 27, 0.6) 100%);
    border: 1px solid rgba(83, 195, 255, 0.2);
    border-radius: 16px;
    margin-bottom: 40px;
}

/* Hero adjustments: larger title, smaller overall container, centered description */
.hero-section {
    max-width: 880px;
    margin: 0 auto 20px;
    text-align: center;
}

.hero-section .highlight-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
    letter-spacing: clamp(0px, 1vw, 1px);
}

/* Use WMCT_One for the main hero title on the blog page */
.blog-page .main-container .highlight-title {
    font-family: 'WMCT_One', sans-serif;
}

.hero-section p {
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    max-width: 720px;
}

/* Inbox Container */
.inbox-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 20px;
    min-height: 600px;
}

/* Inbox Sidebar */
.inbox-sidebar {
    flex: 0 0 250px;
    background: rgba(11, 15, 27, 0.6);
    border: 1px solid rgba(76, 132, 182, 0.3);
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
}

.inbox-logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4c84b6;
    margin-bottom: 30px;
    text-align: center;
    font-family: 'WMCT_One', sans-serif;
}

.inbox-stats {
    background: rgba(76, 132, 182, 0.1);
    border: 1px solid rgba(76, 132, 182, 0.3);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.inbox-stats h3 {
    color: #4c84b6;
    font-size: 0.9rem;
    margin: 0 0 10px 0;
    font-family: 'Blogger', sans-serif;
}

.inbox-stat-item {
    display: flex;
    justify-content: space-between;
    color: #ffffff;
    font-size: 0.85rem;
    margin: 8px 0;
    font-family: 'Blogger', sans-serif;
}

.inbox-stat-item .count {
    color: #4c84b6;
    font-weight: bold;
}

.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(76, 132, 182, 0.3);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Blogger', sans-serif;
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(76, 132, 182, 0.2);
    border-color: #4c84b6;
}

.filter-btn.active {
    background: #4c84b6;
    border-color: #4c84b6;
    box-shadow: 0 0 10px rgba(76, 132, 182, 0.5);
}

/* Email List */
.email-list {
    flex: 1;
    background: rgba(11, 15, 27, 0.6);
    border: 1px solid rgba(76, 132, 182, 0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-list-header {
    background: rgba(76, 132, 182, 0.1);
    border-bottom: 1px solid rgba(76, 132, 182, 0.3);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-list-header h2 {
    color: #ffffff;
    font-size: 1.2rem;
    margin: 0;
    font-family: 'Blogger', sans-serif;
}

.email-count {
    color: #4c84b6;
    font-size: 0.9rem;
    font-family: 'Blogger', sans-serif;
}

.email-items {
    flex: 1;
    overflow-y: auto;
    max-height: 900px;
}

/* Email Item */
.email-item {
    border-bottom: 1px solid rgba(76, 132, 182, 0.2);
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.email-item:hover {
    background: rgba(76, 132, 182, 0.1);
    border-left: 3px solid #4c84b6;
    padding-left: 17px;
}

.email-item.unread {
    background: rgba(76, 132, 182, 0.05);
    border-left: 3px solid #4c84b6;
    padding-left: 17px;
}

.email-item.selected {
    background: rgba(76, 132, 182, 0.2);
    border-left: 3px solid #4c84b6;
    padding-left: 17px;
}

.email-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.email-sender {
    color: #ffffff;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: 'Blogger', sans-serif;
}

.email-item.unread .email-sender {
    color: #4c84b6;
}

.email-date {
    color: #888;
    font-size: 0.85rem;
    font-family: 'Blogger', sans-serif;
}

.email-subject {
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-family: 'Blogger', sans-serif;
    font-weight: 600;
}

.email-preview {
    color: #aaa;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Blogger', sans-serif;
}

.email-tags {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.email-tag {
    background: rgba(76, 132, 182, 0.2);
    border: 1px solid rgba(76, 132, 182, 0.4);
    color: #4c84b6;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-family: 'Blogger', sans-serif;
}

/* Email Content Display */
.email-content-container {
    flex: 1.5;
    background: rgba(11, 15, 27, 0.6);
    border: 1px solid rgba(76, 132, 182, 0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-content-header {
    background: rgba(76, 132, 182, 0.1);
    border-bottom: 1px solid rgba(76, 132, 182, 0.3);
    padding: 20px;
}

.email-content-subject {
    color: #ffffff;
    font-size: 1.4rem;
    margin: 0 0 15px 0;
    font-family: 'Blogger', sans-serif;
}

.email-content-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.email-meta-row {
    display: flex;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: 'Blogger', sans-serif;
}

.email-meta-label {
    font-weight: bold;
    color: #4c84b6;
    min-width: 60px;
}

.email-content-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.email-content-body p {
    color: #ffffff;
    line-height: 1.8;
    margin-bottom: 15px;
    font-family: 'Blogger', sans-serif;
    font-size: 0.95rem;
}

.email-content-body h3 {
    color: #4c84b6;
    margin-top: 25px;
    margin-bottom: 15px;
    font-family: 'Blogger', sans-serif;
}

.email-content-body ul,
.email-content-body ol {
    color: #ffffff;
    font-family: 'Blogger', sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 15px;
    padding-left: 20px;
}

.email-content-body ul {
    list-style: disc;
}

.email-content-body ol {
    list-style: decimal;
}

.email-content-body li {
    color: #ffffff;
    margin-bottom: 8px;
    padding-left: 5px;
}

.email-content-body a {
    color: #4c84b6;
    text-decoration: underline;
}

.email-content-body a:hover {
    color: #6ca4d6;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}

.empty-state-icon {
    font-size: 4rem;
    color: rgba(76, 132, 182, 0.3);
    margin-bottom: 20px;
}

.empty-state-text {
    color: #888;
    font-size: 1.1rem;
    font-family: 'Blogger', sans-serif;
}

/* Scrollbar Styling */
.email-items::-webkit-scrollbar,
.email-content-body::-webkit-scrollbar {
    width: 8px;
}

.email-items::-webkit-scrollbar-track,
.email-content-body::-webkit-scrollbar-track {
    background: rgba(11, 15, 27, 0.4);
}

.email-items::-webkit-scrollbar-thumb,
.email-content-body::-webkit-scrollbar-thumb {
    background: rgba(76, 132, 182, 0.4);
    border-radius: 4px;
}

.email-items::-webkit-scrollbar-thumb:hover,
.email-content-body::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 132, 182, 0.6);
}

/* Page Header */
.inbox-page-header {
    text-align: center;
    margin-bottom: 30px;
}

.inbox-page-title {
    font-size: 2.5rem;
    color: #ffffff;
    font-family: 'WMCT_One', sans-serif;
    margin: 0 0 10px 0;
    color: #ffea63;
    text-shadow: 0 0 25px rgba(255, 234, 99, 0.4);
}

.inbox-page-subtitle {
    color: #888;
    font-size: 1rem;
    font-family: 'Blogger', sans-serif;
}

/* Mobile-only: stacked, touch-friendly inbox for small viewports */
@media (max-width: 1250px) {
    .inbox-container {
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    .inbox-sidebar {
        order: 1;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 8px;
        background: transparent;
        border: none;
    }

    .inbox-logo {
        display: block;
        margin-bottom: 6px;
    }

    .filter-buttons {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .filter-btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 1rem;
        text-align: left;
        box-sizing: border-box;
    }

    .email-list {
        order: 2;
        width: 100%;
        max-height: 44vh;
        overflow-y: auto;
        padding: 8px;
        border-radius: 10px;
    }

    .email-items {
        max-height: 40vh;
        overflow-y: auto;
    }

    .email-content-container {
        order: 3;
        width: 100%;
        max-height: 50vh;
        overflow-y: auto;
        margin-top: 6px;
    }

    .email-content-body {
        max-height: calc(50vh - 120px);
        overflow-y: auto;
        padding: 16px;
    }

    /* Reduce hero title on small phones so layout doesn't push wide */
    @media (max-width: 480px) {
        .hero-section .highlight-title {
            font-size: 1.8rem;
            line-height: 1.1;
        }

        .hero-section p {
            font-size: 0.95rem;
            padding: 0 8px;
        }
    }

    /* Defensive: ensure no element in the inbox escapes viewport */
    .inbox-container,
    .main-container,
    .email-list,
    .email-content-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    .main-container {
        padding: 20px 16px;
        margin-left: 12px;
        margin-right: 12px;
        box-sizing: border-box;
    }

    .inbox-container {
        gap: 10px;
    }

    .email-list {
        max-height: 48vh;
        padding: 10px;
    }

    .email-items {
        max-height: 44vh;
    }

    .email-content-container {
        max-height: 55vh;
    }

    .email-content-body {
        max-height: calc(55vh - 100px);
        padding: 14px 12px;
    }
}

/* ================================================================
   Mobile email popup overlay (≤768px only)
   The "select an email" panel is hidden; clicking an email triggers
   lore.js to add .mobile-open to .inbox-container, which makes the
   content slide in as a fixed full-screen overlay.
   Desktop/tablet (>768px) is completely unaffected.
   ================================================================ */
@media (max-width: 768px) {

    /* Lock page scroll while popup is open */
    body:has(.inbox-container.mobile-open) {
        overflow: hidden;
    }

    /* Hide the static "Select an email to read" panel by default */
    .email-content-container {
        display: none;
        max-height: none;
    }

    /* Popup overlay — shown when lore.js adds .mobile-open */
    .inbox-container.mobile-open .email-content-container {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 9000;
        background: #0b0f1b;
        overflow-y: auto;
        max-height: none;
        padding: 0;
        animation: mobile-email-popup 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    }

    @keyframes mobile-email-popup {
        from {
            transform: translateY(36px);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Back button — sticky bar at top of popup */
    .mobile-back-btn {
        display: block;
        position: sticky;
        top: 0;
        z-index: 1;
        background: rgba(11, 15, 27, 0.96);
        border: none;
        border-bottom: 1px solid rgba(76, 132, 182, 0.28);
        color: #4da6ff;
        font-family: 'Blogger', sans-serif;
        font-size: 1rem;
        font-weight: bold;
        padding: 14px 16px;
        text-align: left;
        width: 100%;
        cursor: pointer;
        box-sizing: border-box;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    .mobile-back-btn:active {
        background: rgba(76, 132, 182, 0.15);
    }

    /* Email header and body inside the popup */
    .email-content-header {
        padding: 16px 16px 10px;
    }

    .email-content-body {
        padding: 18px 16px;
        max-height: none;
        overflow-y: visible;
        flex: 1;
    }

    /* Better padding for inbox items */
    .email-item {
        padding: 14px 12px;
    }

    .email-sender {
        font-size: 0.97rem;
    }

    .email-subject {
        font-size: 1rem;
    }

    .email-preview {
        font-size: 0.85rem;
    }

    /* Cap the email list so it doesn't fill the whole page on mobile */
    .email-list {
        max-height: 60vh;
        overflow-y: auto;
        padding: 8px 10px;
    }

    .email-items {
        max-height: none;
    }

    .inbox-container {
        gap: 12px;
        padding: 0 12px;
        box-sizing: border-box;
    }
}