:root {
    --bg-1: #0a0a1a;
    --bg-2: #1a1a2e;
    --bg-3: #16213e;
    --card-bg: rgba(15, 23, 42, 0.65);
    --sidebar-bg: rgba(10, 15, 30, 0.95);
    --cyan: #00f0ff;
    --cyan-dim: rgba(0, 240, 255, 0.15);
    --cyan-glow: rgba(0, 240, 255, 0.35);
    --orange: #ff9f0a;
    --orange-dim: rgba(255, 159, 10, 0.12);
    --red: #ff453a;
    --red-dim: rgba(255, 69, 58, 0.12);
    --purple: #7c3aed;
    --purple-dim: rgba(124, 58, 237, 0.15);
    --purple-glow: rgba(124, 58, 237, 0.3);
    --green: #22c55e;
    --text: #f1f7fc;
    --text-dim: rgba(241, 247, 252, 0.5);
    --border: rgba(255, 255, 255, 0.06);
    --glass: rgba(255, 255, 255, 0.03);
    --radius: 20px;
    --radius-lg: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background: var(--bg-1);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(0, 240, 255, 0.06), transparent),
        radial-gradient(ellipse 60% 50% at 80% 70%, rgba(124, 58, 237, 0.06), transparent),
        radial-gradient(ellipse 50% 40% at 50% 10%, rgba(255, 159, 10, 0.03), transparent);
    z-index: 0;
    animation: bgShift 12s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

.hidden { display: none !important; }

/* ==================== ONBOARDING ==================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(5, 5, 20, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: onbFade 0.5s ease;
}

@keyframes onbFade {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.onboarding-card h2 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.onboarding-card p {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 24px;
}

.onboarding-steps {
    text-align: right;
    margin-bottom: 28px;
}

.onboarding-steps li {
    list-style: none;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--glass);
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.onboarding-steps li i {
    width: 22px;
    color: var(--cyan);
}

.onboarding-btn {
    background: linear-gradient(135deg, var(--purple), #5b21b6);
    color: #fff;
    border: none;
    padding: 14px 40px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    width: 100%;
}

.onboarding-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px var(--purple-glow);
}

/* ==================== CALCULATOR ==================== */
.calculator-wrapper {
    z-index: 10;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.calculator {
    background: var(--card-bg);
    width: 360px;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.calc-header i {
    color: var(--cyan);
    font-size: 0.9rem;
}

.display {
    background: rgba(2, 6, 23, 0.7);
    height: 110px;
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
}

.display::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan-dim), transparent);
}

.previous-operand {
    font-size: 1rem;
    color: var(--text-dim);
    min-height: 1.4rem;
    direction: ltr;
}

.current-operand {
    font-size: 2.6rem;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
    direction: ltr;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.btn {
    height: 62px;
    border: none;
    border-radius: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(30, 41, 59, 0.5);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.04);
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    background: rgba(51, 65, 85, 0.6);
}

.btn:active {
    transform: translateY(1px) scale(0.96);
    transition-duration: 0.05s;
}

.operator-btn {
    color: var(--cyan);
    background: var(--cyan-dim);
    border-color: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.05);
}

.operator-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}

.operator-btn:active {
    background: rgba(0, 240, 255, 0.25);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.2);
}

.action-btn {
    color: var(--red);
    background: var(--red-dim);
    border-color: rgba(255, 69, 58, 0.06);
}

.action-btn:hover {
    background: rgba(255, 69, 58, 0.2);
}

.equals-btn {
    background: linear-gradient(135deg, var(--cyan), #0098a8);
    color: #000;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.3);
    font-size: 1.5rem;
}

.equals-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 240, 255, 0.4);
}

.equals-btn:active {
    transform: translateY(1px) scale(0.96);
    box-shadow: 0 2px 10px rgba(0, 240, 255, 0.3);
}

.col-2 { grid-column: span 2; }

/* ==================== VAULT OVERLAY ==================== */
.vault-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-1);
    display: flex;
    z-index: 100;
    animation: vaultSlide 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes vaultSlide {
    from { opacity: 0; transform: scale(1.08); }
    to { opacity: 1; transform: scale(1); }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--cyan);
    margin-bottom: 40px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--cyan-dim);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 13px 16px;
    border-radius: 12px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.25s;
}

.nav-btn i {
    width: 20px;
    font-size: 1rem;
    text-align: center;
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--glass);
    color: var(--cyan);
}

.nav-btn.active {
    border-right: 2px solid var(--cyan);
}

/* Lock button */
.exit-btn {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.15);
    padding: 13px;
    border-radius: 12px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.25s;
    font-size: 0.9rem;
}

.exit-btn:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Main vault content */
.vault-main {
    flex-grow: 1;
    padding: 40px 44px;
    overflow-y: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-info h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info p {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.add-btn {
    background: linear-gradient(135deg, var(--cyan), #0098a8);
    color: #000;
    border: none;
    padding: 11px 22px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.25s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--cyan-glow);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}

.stat-item {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(8px);
    transition: 0.3s;
}

.stat-item:hover {
    border-color: rgba(0, 240, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.img-bg { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.vid-bg { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.doc-bg { background: rgba(34, 197, 94, 0.12); color: #22c55e; }

.count {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
}

.label {
    color: var(--text-dim);
    font-size: 0.82rem;
}

/* Recent files */
.recent-files h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text);
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-dim);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.15;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ==================== NOTE MANAGER ==================== */
.note-manager {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.note-header h2 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-header h2 i {
    color: var(--purple);
}

.note-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#vault-note-area {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    color: var(--text);
    font-size: 0.95rem;
    min-height: 140px;
    resize: vertical;
    outline: none;
    transition: 0.25s;
    font-family: 'Cairo', sans-serif;
}

#vault-note-area:focus {
    border-color: var(--purple);
    box-shadow: 0 0 18px var(--purple-glow);
}

#vault-note-area::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

.save-note-btn {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--purple), #5b21b6);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.25s;
    font-size: 0.85rem;
}

.save-note-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px var(--purple-glow);
}

/* ==================== NOTIFICATION ==================== */
.notif {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--text);
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 2000;
    animation: notifIn 0.35s ease;
    white-space: nowrap;
}

@keyframes notifIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== MOBILE ==================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sidebar-bg);
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px;
    color: var(--text-dim);
    background: none;
    border: none;
    font-size: 10px;
    border-radius: 10px;
    transition: 0.3s;
    cursor: pointer;
    font-family: inherit;
}

.mobile-nav-item i {
    font-size: 20px;
    transition: 0.3s;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--cyan);
    background: rgba(0, 240, 255, 0.06);
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 4px 8px var(--cyan-glow));
}

.fab {
    display: none;
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), #0098a8);
    color: #000;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 6px 25px rgba(0, 240, 255, 0.4);
    align-items: center;
    justify-content: center;
    transition: 0.25s;
}

.fab:active {
    transform: scale(0.88);
}

@media (hover: none) and (pointer: coarse) {
    .btn, .nav-btn, .add-btn, .exit-btn {
        min-height: 48px;
        min-width: 48px;
    }
    .btn { font-size: 1.3rem; }
}

@media (max-width: 768px) {
    .mobile-nav { display: block; }
    .fab { display: flex; }

    .calculator-wrapper {
        padding: 16px;
        padding-bottom: 90px;
    }

    .calculator {
        width: 100%;
        max-width: 400px;
        padding: 20px;
    }

    .display { height: 100px; padding: 14px 16px; }
    .current-operand { font-size: 2.2rem; }
    .btn { height: 58px; font-size: 1.2rem; }

    .vault-overlay { flex-direction: column; }
    .sidebar { display: none; }
    .vault-main { padding: 20px; padding-bottom: 110px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .header-actions { display: none; }
    .main-header { flex-direction: column; gap: 16px; text-align: center; }
    .header-info h1 { font-size: 1.4rem; }

    .onboarding-card { padding: 28px 20px; }
}
