/* ====================================================================
   PREMIUM DOG SHOW SCHOOL DESIGN SYSTEM
   Inspired by Coursera, Stripe, and Linear design principles
   ==================================================================== */

/* CSS Custom Properties - Design System Foundation */
:root {
    /* ===== COLOR PALETTE ===== */
    /* Primary Colors - Deep Navy */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e3a8a;
    --primary-900: #1e40af;
    
    /* Secondary Colors - Warm Gold */
    --secondary-50: #fffbeb;
    --secondary-100: #fef3c7;
    --secondary-200: #fde68a;
    --secondary-300: #fcd34d;
    --secondary-400: #fbbf24;
    --secondary-500: #f59e0b;
    --secondary-600: #d97706;
    --secondary-700: #b45309;
    --secondary-800: #92400e;
    --secondary-900: #78350f;
    
    /* Neutral Colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-600: #16a34a;
    
    --warning-50: #fefce8;
    --warning-500: #eab308;
    --warning-600: #ca8a04;
    
    --error-50: #fef2f2;
    --error-500: #ef4444;
    --error-600: #dc2626;
    
    /* ===== TYPOGRAPHY ===== */
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Font Sizes */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */
    
    /* Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    
    /* ===== SPACING SYSTEM (8px Grid) ===== */
    --space-0: 0;
    --space-1: 0.5rem;   /* 8px */
    --space-2: 1rem;     /* 16px */
    --space-3: 1.5rem;   /* 24px */
    --space-4: 2rem;     /* 32px */
    --space-5: 2.5rem;   /* 40px */
    --space-6: 3rem;     /* 48px */
    --space-8: 4rem;     /* 64px */
    --space-10: 5rem;    /* 80px */
    --space-12: 6rem;    /* 96px */
    --space-16: 8rem;    /* 128px */
    --space-20: 10rem;   /* 160px */
    
    /* ===== SHADOWS ===== */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-base: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* ===== BORDER RADIUS ===== */
    --radius-none: 0px;
    --radius-sm: 0.25rem;   /* 4px */
    --radius-base: 0.5rem;  /* 8px */
    --radius-md: 0.75rem;   /* 12px */
    --radius-lg: 1rem;      /* 16px */
    --radius-xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;
    
    /* ===== TRANSITIONS ===== */
    --transition-fast: 0.15s ease-out;
    --transition-base: 0.2s ease-out;
    --transition-slow: 0.3s ease-out;
    
    /* ===== Z-INDEX SCALE ===== */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ====================================================================
   BASE STYLES & TYPOGRAPHY
   ==================================================================== */

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--gray-900);
    background-color: var(--gray-50);
    margin: 0;
    padding: 80px 0 0 0; /* Top padding for fixed navbar */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: var(--leading-tight);
    color: var(--gray-900);
    margin-top: 0;
    margin-bottom: var(--space-4);
}

h1 { font-size: var(--text-4xl); font-weight: 700; }
h2 { font-size: var(--text-3xl); font-weight: 600; }
h3 { font-size: var(--text-2xl); font-weight: 600; }
h4 { font-size: var(--text-xl); font-weight: 600; }
h5 { font-size: var(--text-lg); font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }

p {
    margin-bottom: var(--space-4);
    color: var(--gray-700);
    line-height: var(--leading-relaxed);
}

/* Links */
a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* Focus States - Remove focus outline from H1 elements entirely */
/* H1 elements shouldn't be focusable unless they have tabindex */
h1:focus {
    outline: none;
}

/* Only show focus outline on H1 elements when explicitly made focusable with tabindex */
h1[tabindex]:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Fallback for browsers without :focus-visible support */
h1[tabindex]:focus:not(.focus-visible) {
    outline: none;
}

h1[tabindex].focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ====================================================================
   LAYOUT COMPONENTS
   ==================================================================== */

.content {
    padding-top: var(--space-6);
    max-width: 1200px;
    margin: 0 auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.container-fluid {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
    color: white;
    padding: var(--space-16) 0;
    text-align: center;
}

.hero-title {
    font-size: var(--text-5xl);
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: white;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--primary-100);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ====================================================================
   CARD COMPONENTS
   ==================================================================== */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) var(--space-5);
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: var(--space-4) var(--space-5);
}

/* Stats Cards */
.stats-card {
    text-align: center;
    padding: var(--space-6);
    border: none;
    background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
}

.stats-card .card-body {
    padding: 0;
}

.stats-number {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--primary-600);
    margin-bottom: var(--space-2);
}

.stats-label {
    font-size: var(--text-sm);
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Course Cards */
.course-card {
    border: none;
    box-shadow: var(--shadow-base);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.course-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.course-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.course-description {
    color: var(--gray-600);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    margin-bottom: var(--space-4);
    flex-grow: 1;
}

/* ====================================================================
   BUTTON COMPONENTS
   ==================================================================== */

.btn {
    font-family: var(--font-heading);
    font-weight: 500;
    border-radius: var(--radius-base);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--primary-600);
    border: 1px solid var(--primary-200);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Outline Button */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-600);
    border: 1px solid var(--primary-600);
}

.btn-outline-primary:hover {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-600) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: white;
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, var(--secondary-500) 0%, var(--secondary-600) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover {
    background: linear-gradient(135deg, var(--secondary-600) 0%, var(--secondary-700) 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: white;
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-lg);
    border-radius: var(--radius-md);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-600);
    text-decoration: underline;
    padding: 0;
    font-weight: 400;
}

.btn-link:hover {
    color: var(--primary-700);
}

/* ====================================================================
   FORM COMPONENTS
   ==================================================================== */

.form-control, .form-select {
    font-family: var(--font-body);
    font-size: var(--text-base);
    padding: var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-base);
    background: white;
    transition: all var(--transition-fast);
    width: 100%;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
    background: white;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-label {
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.form-check-input {
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
}

.form-check-input:checked {
    background-color: var(--primary-600);
    border-color: var(--primary-600);
}

.form-check-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.form-check-label {
    color: var(--gray-700);
    margin-left: var(--space-2);
}

/* Form Validation */
.valid.modified:not([type=checkbox]) {
    border-color: var(--success-500);
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.1);
}

.invalid {
    border-color: var(--error-500);
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

.validation-message {
    color: var(--error-600);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
    font-weight: 500;
}

.darker-border-checkbox.form-check-input {
    border-color: var(--gray-400);
}

/* ====================================================================
   NAVIGATION COMPONENTS
   ==================================================================== */

.navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    /*padding: var(--space-3) 0;*/
}

.navbar-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--primary-600);
}

.nav-link {
    color: var(--gray-600);
    font-weight: 500;
    transition: color var(--transition-fast);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-base);
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-600);
    background: var(--primary-50);
}

/* Dark Navbar Specific Styling */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 0 4px;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #ffffff;
    background-color: var(--primary-600);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ====================================================================
   PROGRESS COMPONENTS
   ==================================================================== */

.progress {
    height: var(--space-2);
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-500) 0%, var(--primary-600) 100%);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
}

/* ====================================================================
   ALERT COMPONENTS
   ==================================================================== */

.alert {
    padding: var(--space-4);
    border-radius: var(--radius-base);
    border: none;
    margin-bottom: var(--space-4);
}

.alert-success {
    background: var(--success-50);
    color: var(--success-600);
    border-left: 4px solid var(--success-500);
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-600);
    border-left: 4px solid var(--warning-500);
}

.alert-danger {
    background: var(--error-50);
    color: var(--error-600);
    border-left: 4px solid var(--error-500);
}

.alert-info {
    background: var(--primary-50);
    color: var(--primary-600);
    border-left: 4px solid var(--primary-500);
}

/* ====================================================================
   BADGES & LABELS
   ==================================================================== */

.badge {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-secondary {
    background: var(--secondary-100);
    color: var(--secondary-700);
}

.badge-success {
    background: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background: var(--warning-100);
    color: var(--warning-700);
}

/* ====================================================================
   QUIZ COMPONENTS
   ==================================================================== */

.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.question-card {
    border: none;
    box-shadow: var(--shadow-base);
    margin-bottom: var(--space-6);
}

.question-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--space-4);
}

.question-options .form-check {
    margin-bottom: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-base);
    transition: background-color var(--transition-fast);
}

.question-options .form-check:hover {
    background: var(--gray-50);
}

.question-options .form-check-input:checked + .form-check-label {
    color: var(--primary-600);
    font-weight: 500;
}

/* ====================================================================
   RESPONSIVE DESIGN
   ==================================================================== */

@media (max-width: 768px) {
    .content {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }
    
    .hero-title {
        font-size: var(--text-3xl);
    }
    
    .hero-subtitle {
        font-size: var(--text-lg);
    }
    
    .btn-lg {
        width: 100%;
        margin-bottom: var(--space-2);
    }
    
    .card {
        margin-bottom: var(--space-4);
    }
    
    .stats-card .card-body {
        padding: var(--space-4);
    }
    
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }
}

/* Touch-friendly interactions */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: var(--space-3) var(--space-4);
    }
    
    .form-control, .form-select {
        min-height: 44px;
        padding: var(--space-3);
    }
    
    .nav-link {
        padding: var(--space-3);
    }
}

/* ====================================================================
   LOADING & ANIMATIONS
   ==================================================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary-500);
    animation: spin 1s ease-in-out infinite;
}

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

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

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

/* ====================================================================
   ERROR BOUNDARIES & BLAZOR SPECIFIC
   ==================================================================== */

.blazor-error-boundary {
    background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
    padding: var(--space-4) var(--space-4) var(--space-4) var(--space-12);
    color: white;
    border-radius: var(--radius-base);
    margin: var(--space-4) 0;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.blazor-error-boundary::before {
    content: "⚠️";
    position: absolute;
    left: var(--space-4);
    top: var(--space-4);
    font-size: var(--text-xl);
}

.blazor-error-boundary::after {
    content: "An error has occurred. Please refresh the page or contact support.";
    font-weight: 500;
}

#blazor-error-ui {
    background: var(--warning-100);
    bottom: 0;
    box-shadow: var(--shadow-lg);
    display: none;
    left: 0;
    padding: var(--space-3) var(--space-5) var(--space-3) var(--space-5);
    position: fixed;
    width: 100%;
    z-index: var(--z-fixed);
    border-top: 3px solid var(--warning-500);
    color: var(--warning-800);
    font-weight: 500;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--space-3);
    top: var(--space-3);
    font-size: var(--text-lg);
    color: var(--warning-600);
    background: none;
    border: none;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}

#blazor-error-ui .dismiss:hover {
    background: var(--warning-200);
}

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

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-600); }
.text-secondary { color: var(--secondary-600); }
.text-success { color: var(--success-600); }
.text-warning { color: var(--warning-600); }
.text-danger { color: var(--error-600); }
.text-muted { color: var(--gray-500); }

.bg-primary { background-color: var(--primary-600); }
.bg-secondary { background-color: var(--secondary-600); }
.bg-light { background-color: var(--gray-50); }

.shadow-none { box-shadow: none; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-base); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded { border-radius: var(--radius-base); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }