/* ========================================
   FASTING TRACKER — Base Styles
   Aesthetic: Midnight Calm
   ======================================== */

:root {
    /* Blues — primary */
    --blue-50: #eef4ff;
    --blue-100: #d9e6ff;
    --blue-200: #b3cdff;
    --blue-300: #80aeff;
    --blue-400: #5a8ff0;
    --blue-500: #3b6de0;
    --blue-600: #2952c5;
    --blue-700: #1e3fa0;
    --blue-800: #162f78;
    --blue-900: #0f1f50;

    /* Accent — warm highlight for completion */
    --accent: #f0a643;
    --accent-light: #f5c47a;
    --accent-dark: #d48a2a;

    /* Dark surfaces */
    --surface-base: #0d1117;
    --surface-raised: #161b22;
    --surface-overlay: #1c2129;
    --surface-input: #21262d;

    /* Borders */
    --border: #30363d;
    --border-light: #262c36;

    /* Text */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-faint: #484f58;

    /* Semantic */
    --red-400: #f85149;
    --red-500: #da3633;
    --green-400: #3fb950;
    --green-500: #238636;
    --amber-400: #d29922;

    /* Typography */
    --font-display: 'Outfit', -apple-system, sans-serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-base);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue-400);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--blue-300);
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ---- Navbar ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-md);
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.nav-logo {
    display: flex;
    color: var(--blue-400);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all 0.2s var(--ease-out);
}

.nav-link:hover,
.nav-link.active {
    color: var(--blue-400);
    background: var(--surface-overlay);
}

.nav-logout:hover {
    color: var(--red-400);
    background: rgba(248, 81, 73, 0.1);
}

/* ---- Main Content ---- */
.main-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-md) var(--space-2xl);
}

/* ---- Flash Messages ---- */
.flash-container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-sm) var(--space-md) 0;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    animation: flashIn 0.4s var(--ease-out);
}

.flash-success {
    background: rgba(63, 185, 80, 0.1);
    color: var(--green-400);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.flash-danger {
    background: rgba(248, 81, 73, 0.1);
    color: var(--red-400);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.flash-info {
    background: rgba(59, 109, 224, 0.1);
    color: var(--blue-400);
    border: 1px solid rgba(59, 109, 224, 0.3);
}

.flash-close {
    font-size: 20px;
    line-height: 1;
    color: inherit;
    opacity: 0.5;
    padding: 4px;
}

.flash-close:hover {
    opacity: 1;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    padding: 12px var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s;
    outline: none;
    -moz-appearance: textfield;
}

.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-input:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 109, 224, 0.2);
}

.form-input::placeholder {
    color: var(--text-faint);
}

.form-error {
    display: block;
    font-size: 13px;
    color: var(--red-400);
    margin-top: var(--space-xs);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-lg);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    transition: all 0.25s var(--ease-out);
    cursor: pointer;
    border: none;
    min-height: 48px;
    text-decoration: none;
}

.btn--primary {
    background: var(--blue-500);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 109, 224, 0.3);
}

.btn--primary:hover {
    background: var(--blue-400);
    box-shadow: 0 4px 16px rgba(59, 109, 224, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn--primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(59, 109, 224, 0.2);
}

.btn--ghost {
    background: transparent;
    color: var(--blue-400);
    border: 1.5px solid var(--border);
}

.btn--ghost:hover {
    background: var(--surface-overlay);
    border-color: var(--blue-500);
    color: var(--blue-300);
}

.btn--danger {
    background: transparent;
    color: var(--red-400);
    border: 1.5px solid rgba(248, 81, 73, 0.3);
}

.btn--danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

.btn--full {
    width: 100%;
}

.btn--lg {
    padding: 14px var(--space-xl);
    font-size: 16px;
    min-height: 52px;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 32px;
}

/* ---- Spinner ---- */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--blue-400);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-wrap {
    display: flex;
    justify-content: center;
    padding: var(--space-2xl);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Utilities ---- */
.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
    body {
        font-size: 16px;
    }

    .main-content {
        padding: 0 var(--space-lg) var(--space-2xl);
    }
}
