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

:root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --border: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #888;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.nav-links a:hover {
    color: var(--text);
}

main {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* Auth */
.auth-container {
    max-width: 320px;
    margin: 4rem auto;
    text-align: center;
}

.auth-container h1 {
    margin-bottom: 2rem;
}

.auth-container form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-link {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-link a {
    color: var(--primary);
}

/* Forms */
input, select, button {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

button {
    background: var(--primary);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

button:hover {
    background: var(--primary-hover);
}

/* Messages */
.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.progress-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.progress-text {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.progress-current {
    font-weight: 600;
}

.progress-goal {
    color: var(--text-muted);
}

.progress-bar {
    height: 1rem;
    background: var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.progress-percent {
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.caffeine-card {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
}

.caffeine-icon {
    font-size: 1rem;
}

.caffeine-amount {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Presets */
.quick-add h2, .today-drinks h2 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    gap: 0.25rem;
}

.preset-btn:hover {
    border-color: var(--primary);
    background: var(--surface);
}

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

.preset-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.preset-amount {
    font-weight: 600;
}

.custom-form {
    display: flex;
    gap: 0.5rem;
}

.custom-form input {
    flex: 1;
    min-width: 0;
}

.custom-form select {
    width: 100px;
}

.custom-form button {
    padding: 0.75rem 1.5rem;
}

/* Drinks list */
.drinks-list {
    list-style: none;
}

.drink-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.drink-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.drink-type {
    text-transform: capitalize;
    color: var(--text-muted);
    min-width: 60px;
}

.drink-amount {
    font-weight: 600;
}

.drink-time {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.drink-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

.drink-delete:hover {
    color: var(--error);
    background: transparent;
}

.no-drinks, .no-data {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* History */
.history {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.stats-card h2 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
}

.history-list {
    list-style: none;
}

.history-day {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.history-date {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.history-bar-container {
    flex: 1;
    height: 0.5rem;
    background: var(--border);
    border-radius: 0.25rem;
    overflow: hidden;
}

.history-bar {
    height: 100%;
    background: var(--primary);
}

.history-total {
    min-width: 80px;
    text-align: right;
    font-weight: 500;
}

/* Settings */
.settings {
    max-width: 400px;
    margin: 0 auto;
}

.settings h1 {
    margin-bottom: 2rem;
}

.settings-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.settings-section h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.settings-section form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

.input-suffix {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
    .presets-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .custom-form {
        flex-wrap: wrap;
    }

    .custom-form select {
        width: auto;
        flex: 1;
    }
}
