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

:root {
    --bg-base: #09090b;
    --glass-bg: rgba(24, 24, 27, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --danger: #ef4444;
    --success: #10b981;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg-base); color: var(--text-primary); overflow: hidden; display: flex; justify-content: center; align-items: center; height: 100vh; height: 100dvh; }
body::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 15% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 85% 100%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
    z-index: -1;
}

/* App Container - Responsive Magic */
#app {
    width: calc(100% - 24px); 
    height: calc(100dvh - 24px);
    margin: 12px;
    display: flex; flex-direction: column; position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 28px; 
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

@media (min-width: 768px) {
    #app {
        width: 420px; height: 88vh; max-height: 900px; margin: 0;
        border-radius: 40px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 10px rgba(255,255,255,0.02);
    }
}

/* Screens */
.screen { display: none; height: 100%; width: 100%; justify-content: center; align-items: center; padding: 30px; }
.screen.active { display: flex; }

/* Login */
.login-wrapper { width: 100%; text-align: center; }
.logo-icon { font-size: 64px; margin-bottom: 20px; filter: drop-shadow(0 0 15px var(--accent-glow)); }
h1 { font-size: 32px; font-weight: 700; margin-bottom: 5px; letter-spacing: -0.5px; }
.subtitle { color: var(--text-secondary); font-size: 16px; margin-bottom: 40px; }

.input-field {
    width: 100%; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3); color: white; font-size: 16px; margin-bottom: 16px; outline: none;
    transition: all 0.3s;
}
.input-field:focus { border-color: var(--accent); background: rgba(0,0,0,0.5); box-shadow: 0 0 0 4px var(--accent-glow); }

.primary-btn {
    width: 100%; padding: 18px; border-radius: 16px; border: none; font-size: 16px; font-weight: 600;
    background: linear-gradient(135deg, var(--accent), #8b5cf6); color: white; cursor: pointer;
    box-shadow: 0 8px 20px -6px var(--accent-glow); transition: all 0.3s;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 25px -6px var(--accent-glow); }
.primary-btn:active { transform: translateY(0); }
.secondary-btn { background: transparent; border: 1px solid var(--glass-border); box-shadow: none; margin-top: 12px; }
.secondary-btn:hover { background: rgba(255,255,255,0.05); transform: none; }

/* Header */
header {
    height: 65px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px;
    border-bottom: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
header h2 { font-size: 20px; font-weight: 600; }
.icon-btn { background: none; border: none; color: var(--accent); font-size: 16px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px;}

/* Main Views Container */
.views-wrapper { flex: 1; position: relative; overflow: hidden; background: rgba(0,0,0,0.1); }
.view { display: none; height: 100%; overflow-y: auto; overflow-x: hidden; padding-bottom: 30px; }
.view.active { display: block; animation: fadeIn 0.3s ease; }

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

/* List Styling (Premium Mobile iOS/TG feel) */
.section-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 30px 20px 10px; letter-spacing: 1px; text-transform: uppercase; }
.list-group { margin: 0 15px; border-radius: 16px; background: var(--glass-bg); border: 1px solid var(--glass-border); overflow: hidden; }
.list-item { padding: 18px 20px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; cursor: pointer; transition: background 0.2s; }
.list-item:last-child { border-bottom: none; }
.list-item:active { background: rgba(255,255,255,0.03); }

/* Email Items */
.email-sender { font-weight: 600; font-size: 16px; margin-bottom: 6px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-subj { font-size: 15px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-date { font-size: 13px; color: rgba(255,255,255,0.4); float: right; padding-left: 10px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 15px; opacity: 0.5; }

/* Slide Over Reader */
.slide-over { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-base); z-index: 50; display: none; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.slide-over.open { display: flex; transform: translateX(0); }
.reader-content { padding: 25px; overflow-y: auto; flex: 1; }
.reader-title { font-size: 24px; font-weight: 700; margin-bottom: 15px; line-height: 1.3; }
.reader-meta { font-size: 14px; color: var(--text-secondary); padding-bottom: 25px; border-bottom: 1px solid var(--glass-border); margin-bottom: 25px; }
.reader-meta strong { color: white; }
.reader-body { font-size: 16px; line-height: 1.7; color: rgba(255,255,255,0.9); white-space: pre-wrap; }

/* Settings Form */
.list-input { padding: 0; cursor: default; }
.list-input input { width: 100%; background: transparent; border: none; padding: 18px 20px; color: white; font-size: 16px; outline: none; }
.list-action { justify-content: center; color: var(--accent); font-weight: 500; font-size: 16px; }
.list-action.danger { color: var(--danger); }
.msg-box { text-align: center; font-size: 14px; color: var(--danger); margin-top: 15px; min-height: 20px; font-weight: 500;}
.msg-box.success { color: var(--success); }

/* Bottom Nav */
#bottom-nav {
    height: 75px; display: flex; justify-content: space-around; align-items: center;
    background: rgba(15, 16, 21, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border); padding-bottom: env(safe-area-inset-bottom);
}
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 33.3%; height: 100%; color: var(--text-secondary); cursor: pointer; transition: color 0.2s; }
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 24px; margin-bottom: 4px; transition: transform 0.2s; }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-item span { font-size: 11px; font-weight: 600; }

/* Profile */
.profile-header { text-align: center; padding: 40px 20px 10px; }
.avatar { width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); color: white; font-size: 36px; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px; box-shadow: 0 8px 20px -6px var(--accent-glow); }
.profile-email { font-size: 18px; font-weight: 600; }
.admin-textarea { width: 100%; height: 150px; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border); border-radius: 12px; padding: 15px; color: var(--accent); font-family: monospace; font-size: 14px; margin-top: 15px; outline: none; resize: vertical; }

/* Modals */
.modal-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.open { display: flex; opacity: 1; }
.modal-content {
    background: #202022; border-radius: 24px; padding: 30px 24px;
    width: 85%; max-width: 320px; text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: none;
    transform: scale(0.95); transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.open .modal-content { transform: scale(1); }
.modal-content h3 { font-size: 22px; font-weight: 700; margin-bottom: 12px; color: #fff; }
.modal-content p { color: #8ba2b8; font-size: 16px; margin-bottom: 30px; font-weight: 500; }
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { 
    flex: 1; padding: 14px; margin: 0; font-size: 16px; font-weight: 600; 
    border-radius: 4px; border: none; transition: transform 0.1s, box-shadow 0.1s;
    width: auto;
}
.modal-actions .btn.secondary { 
    background: #333333; color: #ffffff; 
    box-shadow: 0 4px 0 #111111;
}
.modal-actions .btn.secondary:active { transform: translateY(4px); box-shadow: 0 0px 0 #111111; }
.modal-actions .btn.secondary:hover { background: #3a3a3a; transform: translateY(0); box-shadow: 0 4px 0 #111111; }

.modal-actions .btn.danger { 
    background: #f04444; color: #000000; 
    box-shadow: 0 4px 0 #8b1c1c;
}
.modal-actions .btn.danger:active { transform: translateY(4px); box-shadow: 0 0px 0 #8b1c1c; }
.modal-actions .btn.danger:hover { background: #f55555; transform: translateY(0); box-shadow: 0 4px 0 #8b1c1c; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }
