:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f1624;
    --accent: #00d9ff;
    --accent-glow: rgba(0, 217, 255, 0.3);
    --text-primary: #e6e6e6;
    --text-secondary: #a0a0a0;
    --success: #00ff88;
    --danger: #ff4757;
    --warning: #ffa502;
    
    --shadow-dark: -8px -8px 16px rgba(255, 255, 255, 0.03),
                   8px 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-inset: inset -4px -4px 8px rgba(255, 255, 255, 0.02),
                    inset 4px 4px 8px rgba(0, 0, 0, 0.3);
    --shadow-light: -4px -4px 8px rgba(255, 255, 255, 0.05),
                    4px 4px 8px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(0, 217, 255, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(0, 255, 136, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.screen {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding-bottom: 80px;
}

/* LOGIN SCREEN */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-align: center;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-secondary);
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.form-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-dark);
    animation: slideUp 0.5s ease;
}

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

.form-card h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.form-card input {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-inset);
}

.form-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-inset), 0 0 20px var(--accent-glow);
}

.btn-primary, .btn-secondary, .btn-danger {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-dark);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #00b8d4 100%);
    color: var(--bg-primary);
}

.btn-primary:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #c44569 100%);
    color: white;
}

.switch-auth {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.switch-auth a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.setup-intro {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.form-card label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-top: 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* MAIN APP */
#mainApp {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.header {
    margin-bottom: 24px;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    padding-bottom: 100px;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* HOME TAB */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow-dark);
    transition: all 0.3s ease;
}

.stat-card.highlight {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.1) 0%, rgba(0, 255, 136, 0.1) 100%);
    border: 2px solid rgba(0, 217, 255, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.stat-icon .material-symbols-outlined {
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.today-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: var(--shadow-dark);
    margin-bottom: 24px;
}

.today-card h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.3rem;
    color: var(--text-secondary);
}

.drink-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.counter-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--accent);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: var(--shadow-dark);
    transition: all 0.2s ease;
}

.counter-btn:active {
    box-shadow: var(--shadow-inset);
    transform: scale(0.95);
}

.counter-display {
    position: relative;
    text-align: center;
}

.counter-value {
    font-size: 4rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.counter-emoji {
    font-size: 2rem;
    margin-top: 8px;
}

.counter-label {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
}

.quick-stats {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow-dark);
}

.quick-stat {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quick-stat:last-child {
    border-bottom: none;
}

.quick-label {
    color: var(--text-secondary);
}

.quick-value {
    color: var(--accent);
    font-weight: 600;
}

/* CALENDAR TAB */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-dark);
}

.calendar-nav h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--accent);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-light);
    transition: all 0.2s ease;
}

.nav-btn:active {
    box-shadow: var(--shadow-inset);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-dark);
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-light);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px 4px;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2) 0%, rgba(0, 255, 136, 0.2) 100%);
    border: 2px solid var(--accent);
}

.calendar-day.has-drinks {
    background: linear-gradient(135deg, rgba(218, 165, 32, 0.3) 0%, rgba(184, 134, 11, 0.3) 100%);
}

.calendar-day.zero-drinks {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.3) 0%, rgba(0, 184, 212, 0.3) 100%);
}

.calendar-day:active {
    transform: scale(0.95);
}

.day-number {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.day-drinks {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* MODAL */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: modalSlide 0.3s ease;
}

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

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-content input {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    box-shadow: var(--shadow-inset);
}

.modal-content input:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions button {
    flex: 1;
}

/* STATS TAB */
.stats-section {
    margin-bottom: 32px;
}

.stats-section h3 {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-dark);
}

.comparison-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comparison-item:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
}

.comparison-label {
    color: var(--text-secondary);
}

.comparison-value {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.2rem;
}

.comparison-diff {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 184, 212, 0.15) 100%);
}

.comparison-diff.negative {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.15) 0%, rgba(196, 69, 105, 0.15) 100%);
}

.total-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.total-stat {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px 16px;
    text-align: center;
    box-shadow: var(--shadow-dark);
}

.total-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.total-icon .material-symbols-outlined {
    font-size: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    border: 2px solid var(--success);
    color: var(--success);
}

.total-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--success);
    margin-bottom: 8px;
}

.total-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* SETTINGS TAB */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-dark);
}

.setting-label {
    color: var(--text-secondary);
}

.setting-value {
    color: var(--accent);
    font-weight: 600;
}

.form-group {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-dark);
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 1rem;
    box-shadow: var(--shadow-inset);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

/* BOTTOM NAVIGATION */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

.nav-item.active {
    color: var(--accent);
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-icon .material-symbols-outlined {
    font-size: 1.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1.5px solid var(--text-secondary);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.nav-item.active .nav-icon .material-symbols-outlined {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 600;
}

/* NOTIFICATION */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

/* RESPONSIVE */
@media (max-width: 400px) {
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .counter-value {
        font-size: 3rem;
    }
}
