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

body {
    font-family: 'Outfit', sans-serif;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0f172a;
    position: relative;
    overflow-x: hidden;
}

/* Background Gradients */
.bg-gradient { background: radial-gradient(circle at top left, #1e1b4b, #0f172a 40%, #020617 100%); }
.bg-gradient::before {
    content: ''; position: absolute; top: -20%; left: -10%; width: 60%; height: 60%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
    filter: blur(80px); z-index: 0; pointer-events: none;
}

/* Glassmorphism Container */
.glass-container {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.center-panel { width: 90%; max-width: 520px; padding: 40px; }
.inbox-dashboard { width: 95%; max-width: 900px; padding: 24px; height: 90vh; display: flex; flex-direction: column; }

@keyframes fadeUp { 0% { opacity: 0; transform: translateY(20px); } 100% { opacity: 1; transform: translateY(0); } }

/* Header */
.app-header { text-align: center; margin-bottom: 32px; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; color: #818cf8; }
.logo h1 { font-size: 28px; font-weight: 700; background: linear-gradient(to right, #e0e7ff, #818cf8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: #94a3b8; font-size: 14px; font-weight: 300; }

/* Dashboard Specifics */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-wrap: wrap; gap: 16px; }
.inbox-meta h2 { font-size: 24px; font-weight: 600; color: #f8fafc; margin-bottom: 4px; }
.inbox-meta p { font-size: 13px; color: #94a3b8; }
.inbox-stats { display: flex; align-items: center; gap: 12px; }
.stat-badge { background: rgba(15, 23, 42, 0.8); padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid rgba(255,255,255,0.05); }
.hl-green { color: #4ade80; border-color: rgba(74, 222, 128, 0.2); }

/* Email List */
.email-list { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 8px; }
.email-list::-webkit-scrollbar { width: 8px; }
.email-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 4px; }
.email-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.email-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Email Card */
.email-card { background: rgba(15, 23, 42, 0.4); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; overflow: hidden; transition: all 0.3s ease; flex-shrink: 0; }
.email-card:hover { border-color: rgba(129, 140, 248, 0.3); background: rgba(15, 23, 42, 0.6); }

.email-card-header { display: flex; align-items: center; padding: 16px; cursor: pointer; gap: 16px; user-select: none; }
.sender-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; color: white; flex-shrink: 0; }
.sender-info { flex-grow: 1; min-width: 0; }
.sender-info h4 { font-size: 15px; font-weight: 600; color: #f8fafc; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subject-line { font-size: 13px; font-weight: 400; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.email-date { font-size: 12px; color: #64748b; white-space: nowrap; flex-shrink: 0; }
.expand-icon { color: #64748b; transition: transform 0.3s; font-size: 10px; }

/* Expansion Mechanics */
.email-card-body { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0, 1, 0, 1); background: rgba(255,255,255,0.95); color: #1e293b; }
.email-card.expanded .email-card-body { max-height: 2000px; transition: max-height 0.5s ease-in-out; }
.email-card.expanded .expand-icon { transform: rotate(180deg); }
.email-card.expanded .email-card-header { border-bottom: 1px solid rgba(255,255,255,0.1); background: rgba(129, 140, 248, 0.1); }

.email-content { padding: 24px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; }

/* Forms & Shared Utils */
.pin-form { display: flex; flex-direction: column; gap: 24px; }
.input-group { display: flex; flex-direction: column; gap: 10px; }
.input-group label { font-size: 13px; color: #cbd5e1; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.pin-input { background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); color: #f8fafc; font-size: 32px; font-weight: 600; text-align: center; letter-spacing: 8px; padding: 16px; border-radius: 16px; outline: none; transition: all 0.3s ease; font-family: monospace; }
.pin-input:focus { border-color: #818cf8; background: rgba(15, 23, 42, 0.8); box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15); }
.pin-input::placeholder { color: rgba(148, 163, 184, 0.3); letter-spacing: normal; font-size: 16px; font-family: 'Outfit'; font-weight: 400; }

.btn-primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white; border: none; padding: 16px 24px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); font-family: inherit; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4); }

.btn-sm { background: rgba(255,255,255,0.1); color: white; border-radius: 8px; padding: 6px 14px; font-size: 13px; text-decoration: none; transition: 0.2s; border: 1px solid rgba(255,255,255,0.05); }
.btn-sm:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }

.alert { padding: 14px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.error-alert { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }

.empty-state { text-align: center; color: #64748b; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

/* Loader Overlay */
.loader-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(8px); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 100; gap: 20px; color: #818cf8; font-weight: 500; }
.loader-overlay.hidden { display: none; }
.loader-spinner { width: 48px; height: 48px; border: 4px solid rgba(129, 140, 248, 0.2); border-top-color: #818cf8; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
