/* Custom Properties for Colors */
:root {
    --primary-blue: #007bff;
    --primary-blue-dark: #0056b3;
    --gradient-blue-start: #007bff;
    --gradient-blue-end: #00d4ff;
    --gradient-gold-start: #ffd700;
    --gradient-gold-end: #ff8c00;
    --success-green: #28a745;
    --error-red: #dc3545;
    --text-dark: #333;
    --text-light: #fff;
    --bg-light: #fff;
    --bg-dark: #1a252f;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-bg-opaque: rgba(255, 255, 255, 0.3);
}

/* Reset and Base Styles (Mobile-First) */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
}

/* Utility Classes */
.text-success {
    color: var(--success-green) !important;
}

.text-danger {
    color: var(--error-red) !important;
}

.text-info {
    color: #17a2b8 !important;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease;
    will-change: opacity;
}

#preloader.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.preloader-icon {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    animation: spinBook 1.5s linear 3;
}

.preloader-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    animation: pulseText 1.5s ease-in-out 3;
}

.preloader-progress {
    width: 60vw;
    max-width: 200px;
    height: 5px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.preloader-progress-bar {
    width: 0;
    height: 100%;
    background: var(--primary-blue);
    animation: progressBar 2s ease-in-out 3;
}

@keyframes spinBook {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes progressBar {
    0% { width: 0; }
    50% { width: 100%; }
    100% { width: 0; }
}

/* Brand Text */
.brand-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    transition: transform 0.3s ease, text-shadow 0.3s ease;
}

.brand-text:hover, .brand-text:focus-visible {
    transform: scale(1.05);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar .navbar-brand.brand-text {
    color: var(--text-dark);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.navbar .navbar-brand.brand-text:hover, .navbar .navbar-brand.brand-text:focus-visible {
    transform: scale(1.1);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.small-brand-text {
    font-size: 1.2rem;
    background: linear-gradient(to right, var(--gradient-gold-start), var(--gradient-gold-end));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

/* Brand Logo (About Section) */
.brand-logo img {
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.brand-logo img:hover, .brand-logo img:focus-visible {
    transform: scale(1.05);
}

.brand-logo-fallback {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-align: center;
}

/* Glassmorphism Effect */
.bg-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

@supports not (backdrop-filter: blur(10px)) {
    .bg-glass {
        background: var(--glass-bg-opaque);
    }
}

.bg-glass:hover, .bg-glass:focus-within {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-dark);
    position: relative;
    transition: color 0.3s ease, transform 0.3s ease;
}

.nav-link:hover, .nav-link:focus-visible {
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-blue);
    transition: width 0.3s ease;
}

.nav-link:hover::after, .nav-link:focus-visible::after {
    width: 100%;
}

.verified-tick {
    width: 20px;
    height: 20px;
    margin-left: 5px;
}

/* Hero Section with Video */
.hero-section {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0.6;
}

.hero-video[style*="display: none"] + .hero-fallback {
    display: block;
}

.hero-fallback {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
}

.hero-content {
    background: rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    border-radius: 12px;
    color: var(--text-light);
    text-align: center;
}

.hero-content h1.brand-text {
    font-size: 1.8rem;
    background: linear-gradient(to right, var(--gradient-gold-start), var(--gradient-gold-end));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content .lead {
    font-size: 0.9rem;
    max-width: 90%;
    margin: 0 auto 1.5rem;
    color: var(--text-light);
}

.btn-primary {
    background: linear-gradient(to right, var(--gradient-blue-start), var(--gradient-blue-end));
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn-primary:hover, .btn-primary:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, var(--primary-blue-dark), #00b7eb);
}

.social-share .btn {
    font-size: 0.9rem;
    border-color: var(--gradient-gold-start);
    color: var(--text-light);
    transition: background 0.3s ease, transform 0.3s ease;
}

.social-share .btn:hover, .social-share .btn:focus-visible {
    background: linear-gradient(to right, var(--gradient-gold-start), var(--gradient-gold-end));
    transform: translateY(-3px);
}

/* Sections */
.profile-section, .courses-section, .testimonials-section, .contact-section {
    padding: 1.5rem 0.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
}

h2::after {
    content: '';
    width: 50px;
    height: 3px;
    background: linear-gradient(to right, var(--gradient-gold-start), var(--gradient-gold-end));
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

h4 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Course and Testimonial Cards */
.course-card, .testimonial-card {
    background: var(--text-light);
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
    border: none;
}

.course-card:hover, .course-card:focus-within,
.testimonial-card:hover, .testimonial-card:focus-within {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.2rem;
}

.card-text {
    font-size: 0.9rem;
}

.testimonial-card .card-text {
    font-style: italic;
    color: #555;
}

.testimonial-card .card-title {
    font-size: 1.1rem;
    margin-top: 1rem;
}

.testimonial-card .card-subtitle {
    font-size: 0.8rem;
    color: #777;
}

/* Contact Form */
.form-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, border 0.3s ease;
}

.form-container:focus-within {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid transparent;
    background: linear-gradient(white, white) padding-box, linear-gradient(to right, var(--gradient-gold-start), var(--gradient-gold-end)) border-box;
}

.form-control {
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
}

.form-check {
    margin-bottom: 0.5rem;
}

.form-check-input {
    margin-top: 0.3rem;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--gradient-gold-start);
    border-color: var(--gradient-gold-end);
}

.form-check-input:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
}

.form-check-label {
    font-size: 0.9rem;
}

.class-checkboxes, .subject-checkboxes {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) #e9ecef;
}

.class-checkboxes.is-invalid, .subject-checkboxes.is-invalid {
    border-color: var(--error-red);
}

.class-checkboxes::-webkit-scrollbar, .subject-checkboxes::-webkit-scrollbar {
    width: 6px;
}

.class-checkboxes::-webkit-scrollbar-thumb, .subject-checkboxes::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 6px;
}

.invalid-feedback {
    font-size: 0.8rem;
    color: var(--error-red);
}

#submit-btn {
    background: linear-gradient(to right, var(--gradient-blue-start), var(--gradient-blue-end));
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

#submit-btn:hover, #submit-btn:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(to right, var(--primary-blue-dark), #00b7eb);
}

#submit-btn .spinner-border {
    vertical-align: middle;
    margin-left: 8px;
}

#form-message.success {
    color: var(--success-green);
}

#form-message.error {
    color: var(--error-red);
}

/* Contact Info */
.contact-info p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.contact-info p:hover, .contact-info p:focus {
    color: var(--primary-blue);
}

/* WhatsApp Icon */
.whatsapp-icon {
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.whatsapp-icon:hover, .whatsapp-icon:focus-visible {
    transform: scale(1.1);
}

.whatsapp-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 70px;
    right: 20px;
    z-index: 1000;
    display: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

/* Cookie Consent */
#cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    padding: 15px;
    border-radius: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    z-index: 1000;
    display: none;
}

#cookie-consent p {
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-dark);
}

#cookie-consent button {
    background: linear-gradient(to right, var(--gradient-blue-start), var(--gradient-blue-end));
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-left: 10px;
    transition: background 0.3s ease;
}

#cookie-consent button:hover, #cookie-consent button:focus-visible {
    background: linear-gradient(to right, var(--primary-blue-dark), #00b7eb);
}

#cookie-consent a {
    color: var(--primary-blue);
    transition: color 0.3s ease;
}

#cookie-consent a:hover, #cookie-consent a:focus {
    color: var(--gradient-gold-start);
}

/* Footer */
footer {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 2rem 1rem;
}

footer a {
    color: var(--gradient-blue-end);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover, footer a:focus {
    color: var(--gradient-gold-start);
}

.social-links i {
    font-size: 1.5rem;
    margin: 0 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-links i:hover, .social-links i:focus-visible {
    color: var(--gradient-gold-start);
    transform: scale(1.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInHero {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    #preloader, .preloader-text, .preloader-icon, .preloader-progress-bar,
    .brand-text, .navbar .navbar-brand.brand-text, .nav-link, .btn-primary,
    .social-share .btn, .course-card, .testimonial-card, .form-container,
    .whatsapp-icon, #cookie-consent button, .invalid-feedback {
        animation: none;
        transition: none;
    }
    .brand-text:hover, .navbar .navbar-brand.brand-text:hover,
    .nav-link:hover, .btn-primary:hover, .social-share .btn:hover,
    .course-card:hover, .testimonial-card:hover, .whatsapp-icon:hover,
    .social-links i:hover {
        transform: none;
    }
}

/* Focus States for Accessibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Media Queries for Smaller Screens */
@media (max-width: 575.98px) {
    .preloader-icon {
        font-size: 1.2rem;
    }
    .preloader-text {
        font-size: 0.8rem;
    }
    .preloader-progress {
        width: 80vw;
        max-width: 150px;
    }
}

/* Media Queries for Larger Screens */
@media (min-width: 576px) {
    .navbar-brand {
        font-size: 1.5rem;
    }
    .nav-link {
        font-size: 1rem;
    }
    .hero-section {
        min-height: 80vh;
    }
    .hero-content h1.brand-text {
        font-size: 2.5rem;
    }
    .hero-content .lead {
        font-size: 1.1rem;
        max-width: 70%;
    }
    .whatsapp-icon {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }
    .preloader-progress {
        width: 60vw;
        max-width: 250px;
    }
    .course-card .card-body {
        padding: 1.5rem;
    }
    .course-card h5 {
        font-size: 1.2rem;
    }
    .course-card p {
        font-size: 1rem;
    }
    .subject-checkboxes, .class-checkboxes {
        max-height: 200px;
    }
}

@media (min-width: 768px) {
    body {
        font-size: 18px;
    }
    .preloader-text {
        font-size: 1.2rem;
    }
    .preloader-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    .brand-text, .navbar .navbar-brand.brand-text {
        font-size: 2rem;
    }
    .brand-logo-fallback {
        font-size: 2rem;
    }
    .small-brand-text {
        font-size: 1.5rem;
    }
    .hero-section {
        min-height: 100vh;
    }
    .hero-content h1.brand-text {
        font-size: 3rem;
    }
    .hero-content .lead {
        font-size: 1.2rem;
    }
    .hero-content .btn {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    .social-share .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    h2 {
        font-size: 2.5rem;
    }
    h4 {
        font-size: 1.5rem;
    }
    .profile-section, .courses-section, .testimonials-section, .contact-section {
        padding: 3.5rem 2rem;
    }
    .form-container {
        padding: 2rem;
    }
    .form-control {
        font-size: 1rem;
    }
    .card-title {
        font-size: 1.3rem;
    }
    .card-text {
        font-size: 1rem;
    }
    .testimonial-card .card-text {
        font-size: 1rem;
    }
    .testimonial-card .card-title {
        font-size: 1.2rem;
    }
    .testimonial-card .card-subtitle {
        font-size: 0.9rem;
    }
    .contact-info p {
        font-size: 1rem;
    }
    #cookie-consent {
        flex-direction: row;
        text-align: left;
        max-width: 400px;
        left: auto;
        right: 20px;
    }
    #cookie-consent button {
        margin-top: 0;
        margin-left: 10px;
    }
}