/* ==========================================================================
   fullstack.fit — Web App Styles
   Extended from landing page design system
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    /* Colors */
    --bg: #faf9f7;
    --bg-subtle: #f0eeea;
    --text: #2c2c2c;
    --text-muted: #6b6b6b;
    --accent: #1a5f4a;
    --accent-hover: #145040;
    --border: #e0ddd6;
    --error: #c53030;
    --error-bg: #fff5f5;

    /* Typography */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 6rem;

    /* Override Pico defaults */
    --pico-font-family: var(--font-body);
    --pico-font-size: 100%;
    --pico-line-height: 1.6;
    --pico-background-color: var(--bg);
    --pico-color: var(--text);
    --pico-muted-color: var(--text-muted);
    --pico-primary: var(--accent);
    --pico-primary-hover: var(--accent-hover);
    --pico-border-color: var(--border);
    --pico-card-background-color: var(--bg-subtle);
    --pico-block-spacing-vertical: var(--space-md);
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    font-weight: 400;
    letter-spacing: -0.01em;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Subtle grain texture */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 9999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 300;
    margin-bottom: var(--space-xs);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: var(--space-md);
}

h3 {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

p {
    max-width: 60ch;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
header {
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav ul {
    list-style: none;
    display: flex;
    gap: var(--space-md);
    margin: 0;
    padding: 0;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

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

.brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text) !important;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.user-email {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.logout-button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-button:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* --------------------------------------------------------------------------
   Auth Pages
   -------------------------------------------------------------------------- */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: var(--space-md) 0;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: var(--space-lg);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: var(--space-xs);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.auth-form {
    margin-top: var(--space-md);
}

.form-group {
    margin-bottom: var(--space-sm);
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 95, 74, 0.1);
}

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

.auth-submit {
    width: 100%;
    margin-top: var(--space-sm);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-md);
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: var(--space-sm);
    border-radius: 4px;
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(197, 48, 48, 0.2);
}

/* --------------------------------------------------------------------------
   CTA Button
   -------------------------------------------------------------------------- */
.cta-button {
    display: inline-block;
    padding: 1rem 2rem;
    background-color: var(--accent);
    color: white !important;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    text-align: center;
}

.cta-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.dashboard-section {
    padding: var(--space-md) 0 var(--space-xl);
}

.dashboard-header {
    margin-bottom: var(--space-lg);
}

.dashboard-header h1 {
    margin-bottom: var(--space-xs);
}

.dashboard-subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.dashboard-card {
    padding: var(--space-md);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
}

.card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-sm);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon svg {
    width: 32px;
    height: 32px;
}

.strength-icon {
    background-color: #1a1a1a;
    color: #faf9f7;
}

.cardio-icon {
    background-color: var(--accent);
    color: white;
}

.recovery-icon {
    background-color: #e0ddd6;
    color: #1a1a1a;
}

.dashboard-card h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: var(--space-xs);
}

.card-stat {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.dashboard-cta {
    text-align: center;
    padding: var(--space-md);
    background-color: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.dashboard-cta p {
    margin: 0 auto;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
    padding-bottom: var(--space-lg);
    margin-top: auto;
}

footer hr {
    border: none;
    border-top: 1px solid var(--border);
    margin-bottom: var(--space-md);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-footer {
    font-family: var(--font-display);
    font-weight: 500;
    margin: 0;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    header {
        padding-top: var(--space-sm);
        padding-bottom: var(--space-sm);
    }

    .brand {
        font-size: 1rem;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
    }

    nav ul {
        gap: var(--space-sm);
    }

    .user-email {
        display: none;
    }

    .auth-card {
        padding: var(--space-md);
    }

    .auth-section {
        min-height: auto;
        padding: var(--space-lg) 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .cta-button {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
    .auth-card,
    .dashboard-card {
        animation: fadeUp 0.4s ease-out both;
    }

    .dashboard-card:nth-child(1) { animation-delay: 0.1s; }
    .dashboard-card:nth-child(2) { animation-delay: 0.2s; }
    .dashboard-card:nth-child(3) { animation-delay: 0.3s; }
}

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