/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d0b0f;
    --bg2: #18141c;
    --bg3: #231e29;
    --bg4: #2f2838;
    --text: #e6dce8;
    --text2: #b8aabf;
    --accent: #c99a6b;
    --accent2: #a87b54;
    --gold: #d4af37;
    --gold-light: #e8c84a;
    --red: #c45a5a;
    --green: #6baa7a;
    --blue: #5a8ab5;
    --border: #3a3242;
    --shadow: rgba(0, 0, 0, 0.6);
    --radius: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --sidebar-width: 220px;
    --transition: 0.2s ease;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--gold);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg2);
}

::-webkit-scrollbar-thumb {
    background: var(--bg4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent2);
}

/* ===== UTILITY CLASSES ===== */
.text-muted {
    color: var(--text2);
}

.mt-1 {
    margin-top: 0.6rem;
}

.mb-1 {
    margin-bottom: 0.6rem;
}

.flex {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

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

.small {
    font-size: 0.85rem;
}

.saved-indicator {
    font-size: 0.75rem;
    color: var(--text2);
    margin-left: auto;
    transition: color 0.3s;
}

.saved-indicator.saving {
    color: var(--gold);
}

.saved-indicator.saved {
    color: var(--green);
}

.saved-indicator.error {
    color: var(--red);
}

/* ===== PASSWORD OVERLAY ===== */
.password-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.4s ease;
}

.password-overlay.open {
    display: flex;
}

.password-overlay .gate-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.4rem 2.8rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

.password-overlay .gate-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.password-overlay .gate-icon {
    font-size: 3.2rem;
    display: block;
    margin-bottom: 0.6rem;
    color: var(--gold);
}

.password-overlay .gate-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.password-overlay .gate-sub {
    color: var(--text2);
    font-size: 0.95rem;
    margin-bottom: 1.4rem;
}

.password-overlay .gate-error {
    color: var(--red);
    font-size: 0.85rem;
    min-height: 1.6rem;
    margin-bottom: 0.2rem;
}

.password-overlay .gate-input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg3);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1.05rem;
    text-align: center;
    letter-spacing: 2px;
    transition: border-color 0.2s;
    font-family: var(--font);
}

.password-overlay .gate-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.12);
}

.password-overlay .gate-input.error {
    border-color: var(--red);
    box-shadow: 0 0 0 4px rgba(196, 90, 90, 0.15);
}

.password-overlay .gate-btn {
    width: 100%;
    padding: 0.7rem;
    margin-top: 0.8rem;
    background: var(--gold);
    color: #1a141a;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: var(--font);
}

.password-overlay .gate-btn:hover {
    background: var(--gold-light);
    transform: translateY(-1px);
}

.password-overlay .gate-btn:active {
    transform: translateY(0);
}

.password-overlay .gate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.password-overlay .gate-foot {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: var(--text2);
    opacity: 0.6;
    letter-spacing: 0.3px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===== TOASTS ===== */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 3000;
    max-width: 340px;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-left: 4px solid var(--gold);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow);
    pointer-events: auto;
}

.toast button {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.2rem;
}

.toast button:hover {
    color: var(--text);
}
