/* Global Variables & Reset */
:root {
    --bg-dark: #080a0c;
    --surface-dark: #11141a;
    --surface-card: #161b22;
    --border-color: #212833;
    --border-hover: #303b4b;
    --text-primary: #f0f3f6;
    --text-secondary: #adb6c4;
    --text-muted: #8e98a6;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-glow: rgba(2, 132, 199, 0.15);
    --success: #198754;
    --success-glow: rgba(25, 135, 84, 0.2);
    
    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', "Fira Code", monospace;
    
    /* Layout Heights */
    --header-height: 72px;
    --banner-height: 38px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Top Promotion Banner */
.top-promo-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(90deg, #6d00ff, #af02ff);
    color: #ffffff;
    font-size: 0.85rem;
    z-index: 1000;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.top-promo-banner.hidden {
    display: none !important;
}

.promo-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.promo-fire-icon {
    font-size: 1rem;
    animation: flicker 1.5s infinite ease-in-out alternate;
}

@keyframes flicker {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255,165,0,0.5)); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 6px rgba(255,69,0,0.8)); }
}

.promo-banner-text {
    font-family: var(--font-ui);
    font-weight: 400;
}

.btn-promo-action {
    background-color: #ffffff;
    color: #6d00ff;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-promo-action:hover {
    background-color: #f3e8ff;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-close-banner {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem;
    transition: color 0.2s;
    font-weight: 300;
}

.btn-close-banner:hover {
    color: #ffffff;
}

@media (max-width: 768px) {
    .top-promo-banner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.65rem 1rem;
        text-align: center;
    }
    .promo-banner-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    .btn-close-banner {
        position: absolute;
        top: 0.25rem;
        right: 0.5rem;
    }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--surface-dark);
    border-bottom: 1px solid var(--border-color);
    height: 72px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-logo {
    height: 52px;
    margin: 0 -12px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    font-family: var(--font-ui);
}
.header-nav {
    display: flex;
    align-items: center;
}

.nav-link-pricing {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.nav-link-pricing:hover {
    color: #ffffff;
    border-color: var(--accent);
    background-color: var(--accent-glow);
}

.icon-svg-pricing {
    width: 14px;
    height: 14px;
}

/* App Main Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-height) - var(--banner-height));
    min-height: 0;
}

/* Left Panel (Controls & Promo) */
.panel-control {
    width: 340px;
    min-width: 340px;
    border-right: 1px solid var(--border-color);
    background-color: var(--surface-dark);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

.control-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex-shrink: 0;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.email-display-container {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.email-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
    font-weight: 500;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background-color: rgba(255, 255, 255, 0.06);
}

.btn-icon.copied {
    color: #fff;
    background-color: var(--success);
    border-color: var(--success);
}

.icon-svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.99);
}

/* Auto Refresh Progress */
.sync-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sync-value {
    font-family: var(--font-mono);
    font-weight: bold;
}

.progress-bar-container {
    height: 4px;
    background-color: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--accent);
    transition: width 1s linear;
}

/* Premium Promo Banner */
.upgrade-card {
    background: linear-gradient(185deg, var(--surface-card), rgba(2, 132, 199, 0.03));
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.upgrade-badge {
    align-self: flex-start;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    letter-spacing: 0.05em;
    background-color: var(--accent-glow);
}

.upgrade-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.upgrade-link {
    font-size: 0.8rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: gap 0.2s;
    border-bottom: 1px solid var(--text-primary);
    padding-bottom: 2px;
    align-self: flex-start;
}

.upgrade-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    gap: 0.4rem;
}

.icon-svg-arrow {
    width: 14px;
    height: 14px;
}

/* Middle / Right Panels Wrapper */
.panel-inbox {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

/* Inbox Column (Middle) */
.inbox-list-wrapper {
    width: 360px;
    min-width: 360px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: var(--surface-dark);
    height: 100%;
}

.inbox-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 57px;
}

.inbox-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.badge {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.inbox-items {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Inbox States & Items */
.inbox-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    gap: 1rem;
}

.pulsing-radar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    position: relative;
}

.pulsing-radar::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent);
    top: -2px;
    left: -2px;
    animation: radar-ripple 1.8s infinite ease-out;
    opacity: 0;
}

@keyframes radar-ripple {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.6); opacity: 0; }
}

.placeholder-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.inbox-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
    background: none;
    border-left: 2px solid transparent;
    width: 100%;
}

.inbox-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.inbox-item.active {
    background-color: rgba(2, 132, 199, 0.05);
    border-left-color: var(--accent);
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-sender {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
    font-weight: 500;
}

.item-time {
    flex-shrink: 0;
}

.item-subject {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message Detail Viewer (Right Column) */
.message-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    overflow: hidden;
    height: 100%;
}

.viewer-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--text-muted);
    gap: 0.75rem;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    color: var(--border-color);
}

.viewer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.message-metadata {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-dark);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meta-row {
    display: flex;
    font-size: 0.8rem;
}

.meta-label {
    color: var(--text-muted);
    width: 70px;
    flex-shrink: 0;
}

.meta-value {
    color: var(--text-secondary);
    word-break: break-all;
}

.text-highlight {
    color: var(--accent);
    font-family: var(--font-mono);
}

.text-bold {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.message-body-container {
    flex: 1;
    position: relative;
    background-color: #fff; /* White background for email body is standard and ensures readability */
    height: 100%;
}

#mail-body-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background-color: #fff;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--surface-card);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 100;
    transition: opacity 0.3s, transform 0.3s;
    transform: translateY(0);
    opacity: 1;
}

.toast.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

/* Helper Class */
.hidden {
    display: none !important;
}

/* Responsive Layout styling */
@media (max-width: 1024px) {
    .inbox-list-wrapper {
        width: 280px;
        min-width: 280px;
    }
    .panel-control {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    .app-container {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .panel-control {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: auto;
        overflow: visible;
        padding: 1rem;
    }
    .panel-inbox {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .inbox-list-wrapper {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        height: 300px;
    }
    .message-viewer {
        height: 500px;
    }
}

/* Promotional Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.modal-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.25rem 2rem;
    max-width: 440px;
    width: 90%;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    animation: modal-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-slide-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close-icon {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-icon:hover {
    color: var(--text-primary);
}

.modal-badge {
    display: inline-block;
    background: var(--accent-glow);
    color: #a855f7; /* matching premium violet accent */
    border: 1px solid rgba(168, 85, 247, 0.4);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.60rem;
    border-radius: 4px;
    margin-bottom: 1.25rem;
    letter-spacing: 0.05em;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.modal-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.75rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-modal-primary {
    background: linear-gradient(90deg, #6d00ff, #af02ff);
    color: #ffffff;
    padding: 0.85rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    display: block;
    box-shadow: 0 4px 12px rgba(109, 0, 255, 0.3);
}

.btn-modal-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(109, 0, 255, 0.4);
}

.btn-modal-secondary {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    width: 100%;
    transition: all 0.2s;
}

.btn-modal-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

/* SEO Content Card Styles */
.seo-card {
    background-color: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0;
}

.seo-text-content {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.seo-text-content strong {
    color: var(--text-primary);
}
