/**
 * SHARED STYLES - Timeplaner
 * Common styles used across all core pages for consistency
 * DO NOT duplicate these styles in individual HTML files
 *
 * v1.2.0 - Added .visually-hidden class for accessible H1 titles (2026-01-04)
 * v1.1.0 - Added WCAG 2.1 accessibility features (2026-01-04)
 */

/* ============================================
   GLOBAL STYLES
   ============================================ */

* {
    box-sizing: border-box;
}

body {
    background-color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ============================================
   COLOR VARIABLES (Design System)
   ============================================ */

:root {
    /* Primary Colors */
    --color-primary-blue: #4a90e2;
    --color-background: #f8fafc;
    --color-white: #ffffff;

    /* Text Colors - WCAG AA compliant (4.5:1 contrast ratio) */
    --color-text-dark: #1f2937;
    --color-text-mid: #6b7280;
    --color-text-light: #6b7280; /* Changed from #9ca3af for WCAG AA compliance */
    --color-text-muted: #9ca3af; /* Use only for large text or non-essential decorative text */

    /* Borders & Dividers */
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;

    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

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

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ============================================
   BLUE HEADER BAR (Used on all pages)
   ============================================ */

.page-header {
    background: var(--color-primary-blue);
    color: white;
    padding: 16px 24px;
}

/* ============================================
   BACK BUTTON - STANDARDIZED PATTERN
   Used on: MasterCalendar, LessonPlanner, Settings
   ============================================ */

.back-link {
    text-decoration: none;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    cursor: pointer;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.back-link i {
    font-size: 20px;
}

/* ============================================
   CARD STYLES
   ============================================ */

.card {
    background: white;
    border-radius: 4px; /* Matches Vuetify default and Calendar.html */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.card-large {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================
   CALENDAR COMMON STYLES
   ============================================ */

.calendar-cell {
    height: 80px;
    padding: 0;
    border: 2px solid var(--color-border);
    position: relative;
    background: white;
    vertical-align: middle;
}

.time-slot-header {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-align: center;
    color: var(--color-text-mid);
    width: 112px;
    padding: 0.5rem;
}

.day-header {
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.5rem;
    text-align: center;
    transition: all 0.3s;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--color-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-skeleton {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-background);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   BUTTONS & INTERACTIVE ELEMENTS
   ============================================ */

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--color-primary-blue);
    color: white;
}

.btn-primary:hover {
    background: #3d7bc7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    color: var(--color-text-dark);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-small { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.font-weight-normal { font-weight: 400; }
.font-weight-medium { font-weight: 500; }
.font-weight-semibold { font-weight: 600; }
.font-weight-bold { font-weight: 700; }

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

/* Flexbox utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

/* Text alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Colors */
.text-primary { color: var(--color-primary-blue); }
.text-dark { color: var(--color-text-dark); }
.text-mid { color: var(--color-text-mid); }
.text-light { color: var(--color-text-light); }

.bg-white { background-color: var(--color-white); }
.bg-gray { background-color: var(--color-background); }
.bg-primary { background-color: var(--color-primary-blue); }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 640px) {
    .hide-mobile { display: none; }
}

@media (min-width: 641px) {
    .hide-desktop { display: none; }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .no-print {
        display: none !important;
    }

    @page {
        size: landscape;
        margin: 1.5cm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   ACCESSIBILITY - WCAG 2.1 COMPLIANCE
   ============================================ */

/**
 * Skip Link - Allows keyboard users to skip navigation
 * WCAG 2.4.1 Bypass Blocks (Level A)
 */
.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10000;
}

.skip-link:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    padding: 12px 24px;
    background: var(--color-primary-blue);
    color: white;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/**
 * Visually Hidden - Content accessible to screen readers but not visible
 * Used for: Page H1 titles, form labels, descriptive text
 * WCAG 2.4.6 Headings and Labels (Level AA)
 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/**
 * Focus Indicators - Visible focus for keyboard navigation
 * WCAG 2.4.7 Focus Visible (Level AA)
 */
*:focus-visible {
    outline: 3px solid var(--color-primary-blue);
    outline-offset: 2px;
}

/* Enhanced focus for buttons */
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid var(--color-primary-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.3);
}

/* Enhanced focus for links */
a:focus-visible {
    outline: 3px solid var(--color-primary-blue);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Enhanced focus for form inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--color-primary-blue);
    outline-offset: 0;
    border-color: var(--color-primary-blue);
}

/**
 * Reduced Motion - Respects user preferences
 * WCAG 2.3.3 Animation from Interactions (Level AAA)
 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/**
 * High Contrast Support
 * Enhances visibility for users who prefer more contrast
 */
@media (prefers-contrast: more) {
    :root {
        --color-text-light: #4b5563; /* Darker for better contrast */
        --color-border: #6b7280;
    }
}
