/* ============================================
   NFR-014: WCAG 2.1 AA Base Styles
   Motivational Engine - Accessibility Foundation
   ============================================ */

/* === Root Colors === */
:root {
    --deep-trust-blue: #1976D2;
    --energetic-orange: #FF9800;
    --clean-cream: #FFF8E1;
    --neutral-gray: #595959;
    --success-green: #4CAF50;
    --alert-red: #F44336;
}

/* === Force Cream Background Globally === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: #FFF8E1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #FFF8E1 !important;
    color: #212121 !important;
    line-height: 1.6;
    min-height: 100vh;
}

.content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: calc(100vh - 200px);
    background: transparent;
}

/* ============================================
   Skip Link (NFR-014 Accessibility)
   ============================================ */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--deep-trust-blue);
    color: white;
    padding: 8px;
    z-index: 1000;
    text-decoration: none;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   Navbar / Header (NFR-013, NFR-014)
   ============================================ */
.navbar {
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    background: var(--deep-trust-blue);
    color: white;
    padding: 0.75rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on mobile */
}

/* Logo */
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.logo-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.logo-text {
    white-space: nowrap;
}

/* Nav links container */
.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Individual link/button styling */
.nav-link,
.nav-button {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
}

.nav-link:hover,
.nav-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.nav-label {
    display: inline;
}

.nav-user {
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Hide legend button on desktop */
.nav-legend-btn {
    display: none;
}

/* Reminder badge (FR-043) */
.reminder-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--alert-red);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.reminder-badge.active {
    display: flex;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   Navigation Legend Dialog (Mobile Help)
   ============================================ */
.nav-legend {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-legend[hidden] {
    display: none;
}

.nav-legend-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.nav-legend-card {
    position: relative;
    z-index: 2001;
    background: white;
    color: #212121;
    padding: 1.5rem;
    border-radius: 8px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.nav-legend-card h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--deep-trust-blue);
}

.nav-legend-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem 0;
}

.nav-legend-card li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 1rem;
}

.nav-legend-card li span {
    font-size: 1.25rem;
}

/* ============================================
   Focus Management (NFR-014)
   ============================================ */
a:focus, button:focus, input:focus, textarea:focus {
    outline: 3px solid var(--energetic-orange);
    outline-offset: 2px;
}

/* ============================================
   Typography (NFR-013)
   ============================================ */
h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #1976D2;
    font-weight: 600;
    line-height: 1.3;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #1976D2;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #212121;
    font-weight: 600;
    line-height: 1.3;
}

p {
    line-height: 1.65;
}

/* ============================================
   Buttons (Global)
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
}

.btn-primary {
    background-color: #1976D2;
    color: #FFFFFF;
    border-color: #1976D2;
}

.btn-primary:hover {
    background-color: #1565C0;
    border-color: #1565C0;
}

.btn-secondary {
    background-color: white;
    color: #1976D2;
    border: 2px solid #1976D2;
}

.btn-secondary:hover {
    background-color: #E3F2FD;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background-color: #FFF8E1;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ============================================
   Progress Bars (FR-055)
   ============================================ */
.progress-bar {
    height: 24px;
    background: #E0E0E0;
    border-radius: 4px;
    position: relative;
    margin: 8px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
}

.progress-fill--low { background: #F44336; }
.progress-fill--medium { background: #FF9800; }
.progress-fill--good { background: #4CAF50; }
.progress-fill--excellent { background: #1976D2; }

/* ============================================
   Screen Reader Only
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Dashboard Layout
   ============================================ */
.dashboard-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ============================================
   Mobile Responsive (NFR-013)
   Icons-only, nav on separate line
   ============================================ */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 0.5rem;
    }

    .nav-container {
        gap: 0.75rem;
        /* Force nav-links to wrap to next line */
        justify-content: center;
    }

    .logo {
        /* Logo takes full width on first row */
        flex: 1 1 100%;
        justify-content: center;
        font-size: 1.3rem;
    }

    /* Nav links on second row, single line, icons only */
    .nav-links {
        flex: 1 1 100%;
        gap: 0.25rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        padding: 0 0.25rem;
    }

    .nav-link,
    .nav-button {
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }

    /* Hide text labels on mobile, show icons only */
    .nav-label {
        display: none;
    }

    /* Hide username on mobile to save space */
    .nav-user {
        display: none;
    }

    /* Show legend/help button on mobile only */
    .nav-legend-btn {
        display: inline-flex;
    }

    /* Dashboard adjustments */
    .dashboard-layout {
        padding: 1rem 0.75rem;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.25rem; }
}

/* ============================================
   Accessibility: High Contrast & Reduced Motion
   ============================================ */
@media (prefers-contrast: high) {
    * {
        border-color: #000 !important;
    }

    button, a.btn {
        border: 3px solid #000 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Content & Metadata Typography
   ============================================ */
.description, .content-text {
    font-weight: 500;
    color: #212121;
}

.metadata, .meta-text, .timestamp {
    font-weight: 400;
    color: #757575;
}

