/* ===================================================
   Nusantara TempMail - Modern Glassmorphic CSS
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Light Theme (Default) */
    --bg-gradient: radial-gradient(at 0% 0%, #eff6ff 0px, transparent 50%),
                   radial-gradient(at 100% 0%, #f0fdf4 0px, transparent 50%),
                   radial-gradient(at 100% 100%, #faf5ff 0px, transparent 50%),
                   #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-surface: #ffffff;
    --border-color: rgba(226, 232, 240, 0.8);
    --border-highlight: rgba(99, 102, 241, 0.2);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-glow: 0 0 25px rgba(79, 70, 229, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --blur: blur(16px);
}

[data-theme="dark"] {
    --bg-gradient: radial-gradient(at 0% 0%, #1e1b4b 0px, transparent 50%),
                   radial-gradient(at 100% 0%, #064e3b 0px, transparent 40%),
                   radial-gradient(at 50% 100%, #1e293b 0px, transparent 50%),
                   #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --bg-surface: #111827;
    --border-color: rgba(55, 65, 81, 0.6);
    --border-highlight: rgba(129, 140, 248, 0.3);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.12);
    
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.12);
    
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
}

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

body {
    font-family: var(--font-primary);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    transition: background 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navbar */
.app-header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-main);
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 99px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn, .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover, .icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px 0;
}

/* Hero Identity Section */
.identity-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.identity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #06b6d4, #10b981);
}

.card-header-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--success-light);
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 99px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
}

.pulse-dot::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: var(--success);
    opacity: 0.4;
    animation: pulse 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}

.action-buttons-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Identity Info Grid */
.identity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.identity-field {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.identity-field:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.08);
    transform: translateY(-2px);
}

.field-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field-label .label-icon {
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-all;
    font-family: var(--font-primary);
}

.field-value.highlight-email {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 800;
}

.field-value.font-mono {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
}

/* Copy Button Specific */
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

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

.btn-copy svg {
    width: 15px;
    height: 15px;
}

/* Control Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
    transform: translateY(-1px);
}

.btn-outline {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--text-muted);
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

/* Auto Refresh Bar */
.refresh-status-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.timer-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
}

.timer-countdown {
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
}

.progress-container {
    flex: 1;
    min-width: 180px;
    height: 6px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4f46e5, #06b6d4);
    border-radius: 99px;
    transition: width 1s linear;
}

/* Inbox Section */
.inbox-section {
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.inbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.inbox-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inbox-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.badge-count {
    padding: 3px 10px;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 99px;
}

/* Message List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.message-item.unread {
    border-left: 4px solid var(--primary);
    background: var(--bg-card-hover);
}

.msg-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.avatar-initial {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #3730a3;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-content-preview {
    flex: 1;
    min-width: 0;
}

.msg-sender {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-subject {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-snippet {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.msg-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Empty State */
.inbox-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon-wrap {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.empty-icon-wrap svg {
    width: 36px;
    height: 36px;
}

.inbox-empty h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.inbox-empty p {
    font-size: 0.9rem;
    max-width: 440px;
    margin: 0 auto;
}

/* Modal Email Reader */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.modal-title-area h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-main);
}

.modal-meta-row {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-meta-item strong {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.email-rendered-frame {
    width: 100%;
    min-height: 380px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #1e293b;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Footer */
.app-footer {
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .identity-card, .inbox-section {
        padding: 20px;
    }
    
    .identity-grid {
        grid-template-columns: 1fr;
    }

    .field-value {
        font-size: 1rem;
    }

    .field-value.highlight-email {
        font-size: 1.05rem;
    }

    .msg-left {
        gap: 10px;
    }

    .avatar-initial {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .msg-right {
        flex-direction: column;
        align-items: flex-end;
    }
}
