/* ========================================
   NZEC Website - Comprehensive Responsive Styles
   ======================================== */

/* Base Responsive Container */
.container-80 {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    max-width: 1400px;
}

/* ========================================
   Mobile First Breakpoints
   ======================================== */

/* Extra Small Devices (Portrait Phones, less than 576px) */
@media (max-width: 575px) {
    .container-80 {
        width: 95%;
        padding: 0 1rem;
    }

    /* Typography Adjustments */
    h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.5rem !important;
    }

    /* Hero Sections */
    .hero-title,
    [class*="text-5xl"],
    [class*="text-6xl"] {
        font-size: 1.875rem !important;
        line-height: 1.2;
    }

    [class*="text-4xl"] {
        font-size: 1.5rem !important;
    }

    [class*="text-3xl"] {
        font-size: 1.25rem !important;
    }

    [class*="text-2xl"] {
        font-size: 1.125rem !important;
    }

    [class*="text-xl"] {
        font-size: 1rem !important;
    }

    /* Buttons */
    button,
    .btn,
    a[class*="px-8"] {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.875rem !important;
    }

    /* Spacing */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Cards */
    .card,
    [class*="rounded-xl"],
    [class*="rounded-2xl"] {
        padding: 1rem !important;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Hide long text on mobile */
    .hide-on-mobile {
        display: none !important;
    }

    /* Stack flex items */
    .flex-wrap-mobile {
        flex-wrap: wrap;
    }
}

/* Small Devices (Landscape Phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    .container-80 {
        width: 90%;
    }

    h1 {
        font-size: 2.25rem !important;
    }

    h2 {
        font-size: 2rem !important;
    }
}

/* Medium Devices (Tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .container-80 {
        width: 85%;
    }
}

/* Large Devices (Desktops, 992px and up) */
@media (min-width: 992px) {
    .container-80 {
        width: 80%;
    }
}

/* ========================================
   Header & Navigation Responsive
   ======================================== */

/* Topbar Responsive */
.w-full.bg-\[\#071c39\] {
    height: 40px;
}

@media (max-width: 768px) {
    .w-full.bg-\[\#071c39\] {
        height: auto;
        min-height: 65px;
        padding: 0.5rem 0;
    }

    /* Hide extra topbar items on small screens */
    .w-full.bg-\[\#071c39\] span:not(:first-child):not(:nth-child(3)) {
        display: none;
    }

    .w-full.bg-\[\#071c39\] .hidden.sm\:inline-block {
        display: none !important;
    }

    /* Stack topbar content */
    .w-full.bg-\[\#071c39\] > div {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }

    .w-full.bg-\[\#071c39\] .flex.items-center.gap-3 {
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    /* Social links smaller on mobile */
    .w-full.bg-\[\#071c39\] svg {
        width: 1rem;
        height: 1rem;
    }

    /* Book appointment button */
    .w-full.bg-\[\#071c39\] a[class*="bg-"] {
        width: 100%;
        text-align: center;
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
}

/* Navigation Responsive */
nav {
    top: 40px !important;
}

@media (max-width: 768px) {
    nav {
        top: auto !important;
        position: fixed;
        bottom: auto;
    }

    /* Mobile menu full width */
    #mobile-menu {
        position: fixed;
        top: 65px;
        left: 0;
        right: 0;
        background: white;
        z-index: 50;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    /* Hamburger menu */
    #mobile-menu-button {
        display: block;
    }
}

/* ========================================
   Grid Responsive Fixes
   ======================================== */

@media (max-width: 767px) {
    /* Force single column on mobile */
    .grid.md\:grid-cols-2,
    .grid.md\:grid-cols-3,
    .grid.md\:grid-cols-4,
    .grid.lg\:grid-cols-2,
    .grid.lg\:grid-cols-3,
    .grid.lg\:grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
}

/* ========================================
   Hero Section Responsive
   ======================================== */

.carousel-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

@media (max-width: 768px) {
    .carousel-container {
        height: 400px;
    }

    .carousel-overlay {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        bottom: 10px;
    }

    /* Hero content padding */
    [data-hero-overlay] > div {
        padding: 2rem 1rem !important;
    }

    /* CTA buttons stack on mobile */
    [data-hero-overlay] .flex.gap-4 {
        flex-direction: column;
        gap: 0.75rem;
    }

    [data-hero-overlay] a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .carousel-container {
        height: 300px;
    }
}

/* ========================================
   Forms Responsive
   ======================================== */

@media (max-width: 767px) {
    form .grid {
        grid-template-columns: 1fr !important;
    }

    form input,
    form textarea,
    form select,
    form button {
        width: 100%;
    }

    /* Contact form */
    .grid.md\:grid-cols-2 form {
        padding: 1.5rem;
    }
}

/* ========================================
   Modal Responsive
   ======================================== */

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    #service-modal .p-6,
    #service-modal .p-8 {
        padding: 1rem !important;
    }

    #modal-title {
        font-size: 1.25rem !important;
    }

    #service-modal .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   Tables Responsive
   ======================================== */

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   Cards Responsive
   ======================================== */

.why-choose-card,
.sitemap-card,
.scholarship-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .why-choose-card,
    .sitemap-card,
    .scholarship-card {
        padding: 1.25rem;
    }

    .why-choose-icon {
        font-size: 2rem !important;
    }

    /* Card titles */
    .why-choose-card h3,
    .sitemap-card h3 {
        font-size: 1.125rem !important;
    }
}

/* ========================================
   Testimonials Responsive
   ======================================== */

@media (max-width: 768px) {
    [data-testimonials-container] > div {
        padding: 1.5rem;
    }

    .testimonial-text {
        font-size: 0.875rem;
    }
}

/* ========================================
   Footer Responsive
   ======================================== */

footer .grid {
    gap: 2rem;
}

@media (max-width: 767px) {
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    footer .flex.md\:flex-row {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    footer .flex.gap-6 {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ========================================
   FAQ Accordion Responsive
   ======================================== */

@media (max-width: 768px) {
    details {
        padding: 1rem !important;
    }

    details summary {
        font-size: 0.95rem;
    }

    details p {
        font-size: 0.875rem;
    }
}

/* ========================================
   Services Page Responsive
   ======================================== */

@media (max-width: 768px) {
    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 1rem;
    }

    /* Service grid items */
    [data-services-container] > div {
        padding: 1.25rem;
    }
}

/* ========================================
   Career Page Responsive
   ======================================== */

@media (max-width: 768px) {
    /* Job cards */
    .career-job-card {
        padding: 1.5rem;
    }

    .career-job-card h3 {
        font-size: 1.25rem !important;
    }

    /* Benefit cards */
    .benefit-card {
        padding: 1.5rem;
    }

    .benefit-card .w-16.h-16 {
        width: 3rem !important;
        height: 3rem !important;
    }

    .benefit-card svg {
        width: 1.5rem !important;
        height: 1.5rem !important;
    }
}

/* ========================================
   New Zealand Page Responsive
   ======================================== */

@media (max-width: 768px) {
    /* University cards */
    [data-universities-container] > div {
        padding: 1rem;
    }

    .university-logo {
        font-size: 2rem !important;
    }

    /* Course cards */
    [data-courses-container] > div {
        padding: 1rem;
    }

    [data-courses-container] .text-4xl {
        font-size: 2rem !important;
    }
}

/* ========================================
   Images Responsive
   ======================================== */

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    /* Hero images */
    section img[src*="unsplash"] {
        object-fit: cover;
        max-height: 300px;
    }

    /* Certificate images */
    img[alt*="Certificate"],
    img[alt*="certificate"] {
        max-width: 100%;
        height: auto;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Text alignment responsive */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center !important;
    }

    .text-left-mobile {
        text-align: left !important;
    }
}

/* Padding responsive */
@media (max-width: 767px) {
    .p-mobile-sm {
        padding: 1rem !important;
    }

    .px-mobile-sm {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-mobile-sm {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    header,
    footer,
    nav,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }

    .container-80 {
        width: 100%;
    }
}

/* ========================================
   Landscape Mobile Orientation
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .carousel-container {
        height: 300px;
    }

    section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}

/* ========================================
   Touch Device Optimizations
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .hover\:shadow-xl:hover,
    .hover\:shadow-2xl:hover {
        box-shadow: none;
    }

    /* Increase tap area for mobile menu */
    #mobile-menu-button {
        padding: 0.75rem;
    }
}

/* ========================================
   High DPI Displays
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize images for retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========================================
   Accessibility Improvements
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #5FC0CD;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@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 mode */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor;
    }

    button,
    a {
        text-decoration: underline;
    }
}

/* ========================================
   Performance Optimizations
   ======================================== */

/* Hardware acceleration for animations */
.transform,
.transition {
    will-change: transform;
    transform: translateZ(0);
}

/* Lazy load images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
    opacity: 1;
}
