/* ==========================================================================
   1. CSS VARIABLES & RESET
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #0f172a;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
}

/* ==========================================================================
   2. NAVIGATION BAR
   ========================================================================== */
header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   3. BUTTON STYLES
   ========================================================================== */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

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

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* ==========================================================================
   4. HERO SECTION
   ========================================================================== */
.hero {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 5rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 750px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ==========================================================================
   5. SECTIONS & GRIDS
   ========================================================================== */
section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

section h2 {
    font-size: 2rem;
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

section > p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

/* CSS Grid for Language Cards */
.language-grid, .tutor-grid, .pricing-grid, .steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Card Styling */
.lang-card, .tutor-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lang-card:hover, .tutor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.lang-card .flag {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.lang-card h3, .tutor-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.tutor-tag {
    display: inline-block;
    background-color: #e0f2fe;
    color: #0369a1;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.8rem;
}

.tutor-card p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
}

/* ==========================================================================
   6. FILTER BUTTONS
   ========================================================================== */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-dark);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--text-muted);
}

/* ==========================================================================
   8. JAVASCRIPT UTILITY CLASSES
   ========================================================================== */
.tutor-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease, display 0.3s ease allow-discrete;
}

.tutor-card.hide {
    display: none;
    opacity: 0;
}

/* ==========================================================================
   9. PRICING SECTION
   ========================================================================== */
.pricing-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.pricing-card .btn-secondary, .pricing-card .btn-primary {
    margin-top: auto; /* Pushes button to the bottom */
}

.price {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 1rem 0;
}

.price sup {
    font-size: 1.5rem;
    font-weight: 500;
    top: -1.2rem;
}

.price-cents {
    font-size: 1.5rem;
    font-weight: 700;
    position: relative;
    top: -1.2rem;
}

.per-lesson-price {
    color: var(--text-muted);
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.features-list {
    list-style: none;
    margin-bottom: 2rem;
    text-align: left;
    color: var(--text-muted);
}

.features-list li {
    margin-bottom: 0.5rem;
}

/* "Most Popular" Card Styling */
.pricing-card.popular {
    border-color: var(--primary-color);
    border-width: 2px;
    transform: scale(1.05);
}

.pricing-card.popular:hover {
    transform: scale(1.05) translateY(-4px);
}

.popular-badge {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
        font-weight: 600;
}


/* ==========================================================================
   10. HOW IT WORKS SECTION
   ========================================================================== */
.how-it-works-section {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.step {
    text-align: center;
    padding: 1rem;
}

.step-icon {
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.step h3 {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.step p {
    color: var(--text-muted);
}

/* ==========================================================================
   11. FAQ SECTION
   ========================================================================== */
.faq-container {
    max-width: 750px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    overflow: hidden; /* Important for the transition */
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: left;
    color: var(--secondary-color);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer p {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-muted);
}

/* Active state for FAQ item */
.faq-item.active .faq-answer {
    max-height: 200px; /* Adjust if answers are longer */
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

/* ==========================================================================
   12. CONTACT SECTION
   ========================================================================== */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px #bfdbfe;
}

.contact-form button {
    align-self: flex-start;
}

.form-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    display: none; /* Hidden by default */
}
.form-status.success {
    background-color: #dcfce7;
    color: #166534;
}
.form-status.error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ==========================================================================
   13. ABOUT US SECTION
   ========================================================================== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1.2fr; /* Image column, Text column */
    gap: 2.5rem;
    align-items: center;
    text-align: left;
}

.about-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    object-fit: cover;
    max-height: 350px;
}

.about-text h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.about-text p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* ==========================================================================
   14. TUTOR PROFILE PAGE
   ========================================================================== */
.profile-page-section {
    padding-top: 2rem; /* Less padding at the top */
}

.profile-header {
    display: grid;
    grid-template-columns: auto 1fr; /* Image size is auto, text takes rest */
    gap: 2.5rem;
    align-items: center;
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 4rem;
}

.profile-image-wrapper img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
}

.profile-details h1 {
    font-size: 2.25rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.profile-bio {
    color: var(--text-muted);
    max-width: 65ch; /* Improve readability */
}

.profile-booking-section h2 {
    text-align: center;
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 2.5rem;
}

.profile-booking-section .booking-note {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ==========================================================================
   16. UTILITY PAGES (e.g., Schedule Page)
   ========================================================================== */
.utility-page-section {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.utility-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.utility-content h1 {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.utility-content .booking-note {
    background-color: #eff6ff;
    color: var(--text-muted);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}

#schedulingContent {
    /* This ensures the calendar and its headers are left-aligned after verification */
    text-align: left;
}

.verification-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    margin: 2rem auto;
    text-align: left;
}

.verification-form input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

.verification-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px #bfdbfe;
}

.utility-content.utility-content--left-aligned {
    text-align: left;
}

/* ==========================================================================
   14.5 CUSTOM SCHEDULER
   ========================================================================== */
.custom-calendar-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-top: 2rem;
    text-align: left;
}

.custom-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.custom-calendar-header h3 {
    flex-grow: 1;
    text-align: center;
    color: var(--secondary-color);
    font-size: 1.25rem;
    margin: 0;
}

.custom-calendar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 workdays */
    /* No gap here; day columns are separated by padding and borders */
}

.custom-calendar-day {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Gap between day header and time slots container */
    padding: 0 0.5rem; /* Padding for the day column content */
}

.custom-calendar-day:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.custom-calendar-day.is-today .custom-calendar-day-header h4 {
    color: var(--primary-color);
    font-weight: 700;
}

.custom-calendar-day-header {
    text-align: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
}

.custom-calendar-day-header h4 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin: 0;
    font-weight: 600;
}

.custom-calendar-day-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.time-slots {
    display: flex;
    flex-direction: column;
    /* Removed gap to make buttons touch vertically */
    border: 1px solid var(--border-color); /* Outer border for the block of time slots */
    border-radius: var(--radius); /* Apply border-radius to the whole block */
    overflow: hidden; /* Ensures inner borders and radius are respected */
    padding: 0; /* Ensure time slots fill the container without internal padding */
}

.time-slot {
    width: 100%;
    background-color: #eff6ff;
    color: var(--primary-color);
    border: none; /* Remove individual button borders */
    border-bottom: 1px solid var(--border-color); /* Add horizontal separator */
    padding: 0.6rem 0.5rem; /* Add horizontal padding */
    border-radius: 0; /* Remove individual button border-radius */
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center; /* Center the time text */
}

.time-slot:last-child {
    border-bottom: none; /* Remove bottom border from the last time slot */
}

.time-slot:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-hover);
}

.time-slot.is-selected {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-hover);
    box-shadow: inset 0 0 0 2px #bfdbfe; /* Use inset shadow for selection */
}

.time-slot.is-past {
    background-color: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    text-decoration: line-through;
}

.time-slot.is-booked {
    background-color: #f1f5f9; /* Same as past for consistency */
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
    font-style: italic;
    font-weight: 400;
}

.confirmation-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.confirmation-container h3 {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

#booking-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#booking-form p {
    margin-bottom: 0;
}

#booking-form input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

#booking-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px #bfdbfe;
}

#booking-form button {
    align-self: flex-start;
}

/* ==========================================================================
   15. RESPONSIVE & MOBILE
   ========================================================================== */

.hamburger {
    display: none; /* Hidden on desktop */
    cursor: pointer;
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: var(--text-dark);
    transition: all 0.3s ease-in-out;
}

@media screen and (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .nav-links {
        position: absolute;
        left: 0;
        top: 100%; /* Position right below the header */
        width: 100%;
        background-color: var(--card-bg);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        
        /* Hide menu by default */
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease-in-out;
    }

    .nav-links.active {
        max-height: 25rem; /* Adjust as needed for number of links */
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow);
    }

    .nav-links a:not(.btn-primary) {
        display: block;
        padding: 1rem 2rem;
        text-align: center;
        border-bottom: 1px solid var(--border-color);
    }

    /* Make the button full-width and give it some space */
    .nav-links li:last-child {
        padding: 1rem 2rem;
        border-bottom: none;
    }

    .nav-links .btn-primary {
        width: 100%;
        padding-top: 0.8rem;
        padding-bottom: 0.8rem;
    }

    /* Animate hamburger to 'X' */
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Other responsive adjustments */
    .hero h1 {
        font-size: 2.25rem;
    }
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    .hero-buttons .btn-primary,
    .hero-buttons .btn-secondary {
        width: 80%;
        max-width: 300px;
    }

    .pricing-card.popular {
        transform: scale(1); /* Don't scale up on mobile */
    }

    .about-content {
        grid-template-columns: 1fr; /* Stack columns on mobile */
        gap: 2.5rem;
    }
    .about-text {
        text-align: center;
    }

    /* Responsive adjustments for profile page */
    .profile-header {
        grid-template-columns: 1fr; /* Stack on mobile */
        text-align: center;
        gap: 1.5rem;
        padding: 2rem;
    }
    .profile-image-wrapper {
        margin: 0 auto;
    }
    .profile-details h1 {
        font-size: 2rem;
    }

    .contact-form button {
        width: 100%;
    }

    .custom-calendar-container {
        padding: 1rem; /* Adjust padding for smaller screens */
    }
    .custom-calendar-grid {
        grid-template-columns: 1fr; /* Stack days on mobile */
        gap: 2rem; /* Space between stacked days */
    }
    .custom-calendar-day:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }
    /* On mobile, each day's time slots block will still have its own border and radius */
    .time-slots {
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
    }
    .time-slot {
        border-left: none; /* Remove side borders on individual slots */
        border-right: none;
    }
}