:root {
    --coffee-dark: #2d1810;
    --coffee-medium: #4a2c1f;
    --coffee-light: #8b6f47;
    --cream: #f5e6d3;
    --foam: #fef9f3;
    --accent: #c17854;
    --shadow: rgba(45, 24, 16, 0.15);
    --shadow-heavy: rgba(45, 24, 16, 0.25);
}
 
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
 
body {
    font-family: 'Work Sans', sans-serif;
    background: linear-gradient(135deg, #f5e6d3 0%, #e6d4bb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}
 
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 1;
}
 
.container {
    max-width: 450px;
    width: 100%;
    position: relative;
    z-index: 2;
    animation: fadeIn 0.6s ease;
}
 
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
 
.hidden {
    display: none !important;
}
 
/* ── Cards ── */
.card {
    background: var(--foam);
    border-radius: 24px;
    padding: 48px 40px;
    box-shadow:
        0 10px 40px var(--shadow),
        0 2px 8px var(--shadow-heavy),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
}
 
.dashboard-card {
    animation: slideUp 0.6s ease;
}
 
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
 
/* ── Steam animation ── */
.coffee-steam {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 80px;
}
 
.steam {
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 60px;
    background: linear-gradient(to top, rgba(139, 111, 71, 0.3), transparent);
    border-radius: 50%;
    animation: steam 3s ease-in-out infinite;
    filter: blur(3px);
}
 
.steam-1 { left: 30%; animation-delay: 0s; }
.steam-2 { left: 50%; animation-delay: 0.8s; }
.steam-3 { left: 70%; animation-delay: 1.6s; }
 
@keyframes steam {
    0%, 100% { transform: translateY(0) scaleX(1); opacity: 0; }
    20%       { opacity: 0.3; }
    50%       { transform: translateY(-30px) scaleX(1.2); opacity: 0.2; }
    80%       { opacity: 0.1; }
}
 
/* ── Logo ── */
.logo {
    text-align: center;
    margin-bottom: 24px;
}
 
.coffee-cup-icon {
    width: 80px;
    height: 80px;
    color: var(--coffee-medium);
    animation: bounce 2s ease-in-out infinite;
}
 
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}
 
/* ── Typography ── */
h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--coffee-dark);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
 
.subtitle {
    text-align: center;
    color: var(--coffee-light);
    margin-bottom: 32px;
    font-size: 0.95rem;
}
 
/* ── Auth tabs ── */
.tab-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--cream);
    padding: 6px;
    border-radius: 12px;
}
 
.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--coffee-medium);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-family: 'Work Sans', sans-serif;
}
 
.tab-btn:hover { background: rgba(139, 111, 71, 0.1); }
 
.tab-btn.active {
    background: var(--foam);
    color: var(--coffee-dark);
    box-shadow: 0 2px 8px var(--shadow);
}
 
/* ── Forms ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
 
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
 
.input-group label {
    font-weight: 600;
    color: var(--coffee-dark);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
 
.input-group input {
    padding: 14px 16px;
    border: 2px solid var(--cream);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Work Sans', sans-serif;
    background: white;
    transition: all 0.3s ease;
    color: var(--coffee-dark);
}
 
.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(193, 120, 84, 0.1);
}
 
/* ── Buttons ── */
.btn-primary {
    padding: 16px;
    background: linear-gradient(135deg, var(--coffee-medium) 0%, var(--coffee-dark) 100%);
    color: var(--foam);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    font-family: 'Work Sans', sans-serif;
    box-shadow: 0 4px 12px var(--shadow);
}
 
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow-heavy); }
.btn-primary:active { transform: translateY(0); }
 
.btn-secondary {
    background: transparent;
    border: 2px solid var(--coffee-light);
    color: var(--coffee-light);
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}
 
.btn-secondary:hover {
    background: var(--coffee-light);
    color: var(--foam);
}
 
.btn-logout {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--coffee-light);
    color: var(--coffee-light);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Work Sans', sans-serif;
    font-size: 0.85rem;
}
 
.btn-logout:hover {
    background: var(--coffee-light);
    color: var(--foam);
}
 
/* ── Error message ── */
.error-message {
    color: #c13d3d;
    background: #fde8e8;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 16px;
    border-left: 4px solid #c13d3d;
    display: none;
}
 
.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}
 
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-8px); }
    75%       { transform: translateX(8px); }
}
 
/* ── Forgot password ── */
.forgot-password-link {
    margin-top: 16px;
    background: none;
    border: none;
    color: var(--coffee-medium);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}
 
.forgot-password-help {
    color: var(--coffee-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
}
 
/* ── Dashboard ── */
.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
 
.user-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--coffee-dark);
}
 
/* ── Progress bar ── */
.progress-section {
    margin-bottom: 40px;
}
 
.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
 
.progress-label span:first-child {
    font-weight: 600;
    color: var(--coffee-dark);
    font-size: 1.1rem;
}
 
.free-badge {
    background: linear-gradient(135deg, #4a2c1f 0%, #2d1810 100%);
    color: var(--foam);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 8px var(--shadow);
}
 
.progress-bar-container {
    position: relative;
    background: var(--cream);
    height: 8px;
    border-radius: 20px;
    overflow: visible;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}
 
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--coffee-medium) 100%);
    border-radius: 20px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(193, 120, 84, 0.3);
}
 
.coffee-icons {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 6px;
    transform: translateY(-50%);
    pointer-events: none;
}
 
.coffee-dot {
    width: 14px;
    height: 14px;
    background: white;
    border: 3px solid var(--coffee-medium);
    border-radius: 50%;
    box-shadow: 0 2px 6px var(--shadow);
    transition: all 0.3s ease;
}
 
.coffee-dot.filled {
    background: var(--coffee-medium);
    border-color: var(--coffee-dark);
}
 
/* ── QR Code ── */
.qr-section {
    text-align: center;
}
 
.qr-instruction {
    color: var(--coffee-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
}
 
.qr-code-wrapper {
    background: white;
    padding: 24px;
    border-radius: 16px;
    display: inline-block;
    box-shadow:
        0 8px 24px var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
 
.qr-code-wrapper img {
    display: block;
    width: 250px;
    height: 250px;
    border-radius: 8px;
}
 
/* ── TOTP ── */
.totp-section {
    margin: 24px 0;
    padding: 20px;
    background: var(--cream);
    border-radius: 16px;
    text-align: center;
}
 
.totp-label {
    font-size: 0.85rem;
    color: var(--coffee-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 12px;
}
 
.totp-code-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}
 
.totp-code {
    font-family: 'Courier New', monospace;
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--coffee-dark);
    letter-spacing: 8px;
}
 
.totp-timer {
    font-size: 0.9rem;
    color: var(--coffee-light);
    font-weight: 600;
    min-width: 36px;
}
 
.totp-timer-bar-container {
    background: rgba(139, 111, 71, 0.2);
    height: 4px;
    border-radius: 4px;
    overflow: hidden;
}
 
.totp-timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--coffee-medium));
    border-radius: 4px;
    transition: width 1s linear, background 0.5s ease;
}

.totp-user-id {
    font-size: 0.95rem;
    color: var(--coffee-medium);
    margin-bottom: 12px;
}

.totp-user-id strong {
    font-size: 1.2rem;
    color: var(--coffee-dark);
}
 
/* ── Recovery codes modal ── */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
 
.modal-content {
    background: var(--foam);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
 
.recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}
 
.recovery-code {
    background: var(--cream);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--coffee-dark);
    border: 2px solid var(--coffee-light);
}
 
.email-prompt {
    margin: 24px 0;
    padding: 16px;
    background: var(--cream);
    border-radius: 12px;
}
 
.email-prompt input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--coffee-light);
    border-radius: 8px;
    margin: 8px 0;
}
 
.email-note {
    font-size: 0.85rem;
    color: var(--coffee-light);
    margin-top: 8px;
}
 
.modal-checkbox {
    margin: 20px 0;
}
 
.modal-checkbox label {
    margin-left: 8px;
}
 
/* ── Mobile ── */
@media (max-width: 480px) {
    .card {
        padding: 32px 24px;
    }
 
    h1 {
        font-size: 2rem;
    }
 
    .qr-code-wrapper img {
        width: 200px;
        height: 200px;
    }
 
    .totp-code {
        font-size: 2.2rem;
        letter-spacing: 4px;
    }
}

/* ── Settings Menu ── */
.settings-menu-container {
    position: relative;
}

.btn-settings {
    background: transparent;
    border: 2px solid var(--coffee-light);
    color: var(--coffee-light);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-settings:hover {
    background: var(--coffee-light);
    color: var(--foam);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--foam);
    border-radius: 16px;
    padding: 20px;
    width: 280px;
    box-shadow: 0 8px 32px var(--shadow-heavy);
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.settings-label {
    font-weight: 600;
    color: var(--coffee-dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-section input,
.settings-section textarea {
    padding: 10px 12px;
    border: 2px solid var(--cream);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: 'Work Sans', sans-serif;
    background: white;
    color: var(--coffee-dark);
    resize: none;
}

.settings-section input:focus,
.settings-section textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.settings-action-btn {
    padding: 10px;
    background: linear-gradient(135deg, var(--coffee-medium) 0%, var(--coffee-dark) 100%);
    color: var(--foam);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: 'Work Sans', sans-serif;
    transition: all 0.3s ease;
}

.settings-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

.settings-divider {
    height: 1px;
    background: var(--cream);
    margin: 12px 0;
}

.settings-msg {
    font-size: 0.85rem;
    color: var(--success, #2d7d46);
    font-weight: 600;
}

.settings-signout {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 2px solid var(--coffee-light);
    color: var(--coffee-light);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: 'Work Sans', sans-serif;
    transition: all 0.3s ease;
}

.settings-signout:hover {
    background: var(--coffee-light);
    color: var(--foam);
}