/* ==================== DRIVEWISE UK - MAIN CSS ==================== */
/* Original Color Scheme - Icons Inherit Colors */

/* ==================== CSS VARIABLES ==================== */
:root {
    --deep-charcoal: #1F2933;
    --safety-amber: #F4B400;
    --chalk-white: #F9FAFB;
    --road-green: #1F7A5C;
    --text-primary: #1F2933;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(31, 41, 51, 0.08);
    --shadow-md: 0 4px 12px rgba(31, 41, 51, 0.12);
    --shadow-lg: 0 8px 24px rgba(31, 41, 51, 0.16);
    --shadow-xl: 0 20px 40px rgba(31, 41, 51, 0.2);
    --transition-speed: 0.3s;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f9fafb 0%, #e5e7eb 100%);
    position: relative;
    overflow-x: hidden;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: clamp(1.1rem, 1.5vw, 1.25rem); }

p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

a {
    color: var(--road-green);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--safety-amber);
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

@media (min-width: 850px) {
    .container {
        padding: 0 2rem;
    }
}

/* ==================== HERO SECTION ==================== */
.hero {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 4rem 0;
    background: linear-gradient(135deg, #1F2933 0%, #2d3748 50%, #1F7A5C 100%);
    overflow: hidden;
}

.hero-with-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-with-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(31, 41, 51, 0.85) 0%, rgba(45, 55, 72, 0.85) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero h1 {
    color: white;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #F4B400 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin-bottom: 2rem;
    opacity: 0.95;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 850px) {
    .hero {
        min-height: 450px;
    }
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    text-decoration: none;
    text-align: center;
    line-height: 1;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #F4B400 0%, #FFD54F 100%);
    color: var(--deep-charcoal);
    border-color: var(--safety-amber);
    box-shadow: 0 10px 30px rgba(244, 180, 0, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #FFD54F 0%, #F4B400 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(244, 180, 0, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    color: var(--deep-charcoal);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #F4B400 0%, #FFD54F 100%);
    color: var(--deep-charcoal);
    border-color: var(--safety-amber);
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1.125rem 2.5rem;
    font-size: 1.125rem;
}

/* ==================== CARDS ==================== */
.card,
.service-card,
.instructor-card,
.testimonial-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    position: relative;
}

.card:hover,
.service-card:hover,
.instructor-card:hover,
.testimonial-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Service Cards */
.service-card {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.service-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #F4B400 0%, #FFD54F 100%);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 25px rgba(244, 180, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.service-card:hover .service-icon {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 15px 40px rgba(244, 180, 0, 0.6);
}

.service-icon img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

/* Instructor Cards */
.instructor-photo {
    width: 100%;
    height: 220px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
    overflow: hidden;
    position: relative;
}

.instructor-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(20%) brightness(1.05);
}

.instructor-card:hover .instructor-photo img {
    transform: scale(1.15) rotate(2deg);
    filter: grayscale(0%) brightness(1.1);
}

.instructor-info {
    padding: 1.5rem;
    flex: 1;
}

.instructor-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Star Rating - Icons inherit color from parent */
.rating {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
    color: var(--safety-amber);
}

.stars {
    display: inline-flex;
    flex-direction: row;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: nowrap;
}

.stars img {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.rating-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .rating {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Testimonial Cards */
.testimonial-card {
    padding: 1.5rem;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-left: 4px solid #F4B400;
}

.testimonial-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
    flex: 1;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F4B400 0%, #1F7A5C 100%);
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(244, 180, 0, 0.4);
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.author-course {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==================== GRIDS ==================== */
.services-grid,
.instructors-grid,
.testimonials-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .services-grid,
    .instructors-grid,
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .services-grid,
    .instructors-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== STATS SECTION ==================== */
.stats-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-speed) ease;
    border: 2px solid transparent;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    background: linear-gradient(135deg, #F4B400 0%, #FFD54F 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 1rem;
    transition: all var(--transition-speed) ease;
    background: white;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--safety-amber);
    box-shadow: 0 0 0 3px rgba(244, 180, 0, 0.1);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

@media (max-width: 850px) {
    .form-control {
        font-size: 16px;
    }
}

/* ==================== ICON SYSTEM - INHERIT COLORS ==================== */
.icon-inline {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    object-fit: contain;
    flex-shrink: 0;
}

.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 24px; height: 24px; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 48px; height: 48px; }

.btn .icon-inline {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.5rem;
    vertical-align: -0.2em;
}

h1 .icon-inline { width: 1em; height: 1em; }
h2 .icon-inline { width: 0.9em; height: 0.9em; }
h3 .icon-inline { width: 0.85em; height: 0.85em; }
h4 .icon-inline { width: 0.8em; height: 0.8em; }

/* ==================== ALERTS ==================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border: 2px solid #dc3545;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border: 2px solid #17a2b8;
    color: #0c5460;
}

/* ==================== SECTIONS ==================== */
section {
    padding: 3rem 0;
    position: relative;
}

@media (min-width: 850px) {
    section {
        padding: 5rem 0;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none; }

/* ==================== IMAGES ==================== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #F4B400, #1F7A5C);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #FFD54F, #16634B);
}

/* ==================== ACCESSIBILITY ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus-visible {
    outline: 3px solid var(--safety-amber);
    outline-offset: 2px;
}

/* ==================== MOBILE OPTIMIZATIONS ==================== */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }

    .hero {
        padding: 60px 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .service-card {
        padding: 2rem;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    header,
    footer,
    .btn,
    nav {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card, .service-card, .instructor-card, .testimonial-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    /* ==================== STAR RATING - ENFORCED INLINE DISPLAY ==================== */
.rating {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
    color: var(--safety-amber);
}

.stars {
    display: inline-flex;
    flex-direction: row;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: nowrap;
}

.stars img,
.stars svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    display: inline-block;
}

.rating-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .stars img,
    .stars svg {
        width: 16px;
        height: 16px;
    }
    
    .rating {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ==================== CONTENT PAGES - RESPONSIVE ==================== */
@media (max-width: 850px) {
    .content-section,
    .page-content,
    article {
        padding: 1rem;
    }
    
    .content-section h1,
    .page-content h1,
    article h1 {
        font-size: 1.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .content-section h2,
    .page-content h2,
    article h2 {
        font-size: 1.5rem;
    }
    
    .content-section h3,
    .page-content h3,
    article h3 {
        font-size: 1.25rem;
    }
    
    .content-section p,
    .page-content p,
    article p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .content-section img,
    .page-content img,
    article img {
        max-width: 100%;
        height: auto;
    }
    
    .content-section table,
    .page-content table,
    article table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==================== ENSURE NO HORIZONTAL OVERFLOW ==================== */
body {
    overflow-x: hidden;
}

.container,
.admin-container {
    max-width: 100%;
    overflow-x: hidden;
}

@media (max-width: 850px) {
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Ensure all text doesn't overflow */
    h1, h2, h3, h4, h5, h6, p, span, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* ==================== BUTTON SVG ICONS ==================== */
/* Edit button icon */
.btn[href*="edit"] img,
.btn[href*="edit"] svg {
    transition: filter 0.3s ease;
}

/* Delete button icon */
.btn[href*="delete"] img,
.btn[href*="delete"] svg,
.btn-danger img,
.btn-danger svg {
    transition: filter 0.3s ease;
}

/* View button icon */
.btn[href*="view"] img,
.btn[href*="view"] svg {
    transition: filter 0.3s ease;
}

/* Ensure SVG icons inherit button color */
.btn img,
.btn svg {
    flex-shrink: 0;
}

/* ==================== MOBILE BUTTON FIXES ==================== */
@media (max-width: 850px) {
    /* Keep buttons readable on mobile */
    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Ensure touch targets are at least 44px */
    .btn,
    .btn-sm {
        min-height: 44px;
    }
}
}