/* Responsive Styles */

/* Base Container Responsive */
.container, 
.hero-content, 
.features-container, 
.categories-container, 
.exams-container,
.search-filter-container,
.filter-status {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

/* Large Screens */
@media screen and (max-width: 1200px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .stats-container {
        gap: 1.5rem;
    }

    .stat-box {
        width: 130px;
        padding: 1.2rem;
    }
    
    main {
        overflow-x: hidden;
    }
}

/* Medium Screens (Tablets) */
@media screen and (max-width: 992px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .stats-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }

    .search-filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
        margin-bottom: 1rem;
    }

    .filter-dropdown {
        align-self: flex-end;
    }

    .filter-menu {
        right: 0;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .features-container,
    .categories-container {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.5rem;
    }
    
    /* Improve spacing in exam cards */
    .exam-card {
        margin-bottom: 1rem;
    }
    
    .exams-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

/* Small Screens (Mobile Landscape) */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .header-container {
        padding: 0.7rem 1rem;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 280px;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 1001;
        box-shadow: -5px 0 25px rgba(0,0,0,0.3);
        padding: 2rem;
    }

    .nav-links:before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        opacity: 0.1;
        z-index: -1;
    }

    .nav-links li {
        margin: 1.2rem 0;
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateX(30px);
        transition: all 0.4s ease;
        transition-delay: calc(var(--nav-item-index, 0) * 0.1s);
    }

    .nav-links li:nth-child(1) { --nav-item-index: 1; }
    .nav-links li:nth-child(2) { --nav-item-index: 2; }
    .nav-links li:nth-child(3) { --nav-item-index: 3; }
    .nav-links li:nth-child(4) { --nav-item-index: 4; }
    .nav-links li:nth-child(5) { --nav-item-index: 5; }
    
    .nav-item {
        display: flex;
        justify-content: center;
        padding: 1rem;
        font-size: 1.2rem;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        transform: scale(1);
        transition: all 0.3s ease;
    }

    .nav-item:hover {
        transform: scale(1.05);
        background: rgba(255, 255, 255, 0.15);
    }

    .nav-active {
        transform: translateX(0%);
    }

    .nav-active li {
        opacity: 1;
        transform: translateX(0);
    }

    /* Add a backdrop overlay when mobile menu is active */
    .nav-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(3px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .nav-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    .burger {
        display: block;
        z-index: 1002;
        padding: 10px;
    }

    .burger div {
        width: 25px;
        height: 3px;
        margin: 5px 0;
        border-radius: 3px;
        background-color: var(--light-text);
        transition: all 0.3s ease;
    }

    .toggle .line1 {
        transform: rotate(-45deg) translate(-5px, 6px);
        background-color: white;
    }

    .toggle .line2 {
        opacity: 0;
    }

    .toggle .line3 {
        transform: rotate(45deg) translate(-5px, -6px);
        background-color: white;
    }

    section {
        padding: 3rem 1rem;
    }

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

    .hero h1 {
        font-size: 1.8rem;
    }
    
    .hero p {
        margin-bottom: 2rem;
    }

    .features-container,
    .categories-container {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.5rem;
    }
    
    .exams-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 3% auto;
        max-height: 85vh;
    }

    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Fix the mobile modal scrolling */
    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
        padding: 1.5rem;
    }
    
    /* Improve tab display and scrolling for mobile */
    .tabs {
        position: relative;
        padding-bottom: 10px;
        margin-bottom: 1.5rem;
    }
    
    .tabs:after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(248, 250, 252, 0.9));
        pointer-events: none;
        z-index: 5;
    }
    
    .tabs:before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 10px;
        background: linear-gradient(to left, transparent, rgba(248, 250, 252, 0.9));
        pointer-events: none;
        z-index: 5;
    }
    
    [data-theme="dark"] .tabs:after {
        background: linear-gradient(to right, transparent, rgba(25, 30, 35, 0.9));
    }
    
    [data-theme="dark"] .tabs:before {
        background: linear-gradient(to left, transparent, rgba(25, 30, 35, 0.9));
    }
    
    /* Make tab buttons more touch-friendly */
    .tab-btn {
        padding: 0.7rem 1rem;
        min-width: max-content;
    }
    
    /* Improve the website-btn and modal footer */
    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    .website-btn, .close-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Extra Small Screens (Mobile Portrait) */
@media screen and (max-width: 576px) {
    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .stats-container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .stat-box {
        width: 100%;
        max-width: 200px;
    }

    .cta-button {
        padding: 0.7rem 1.5rem;
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .section-header {
        margin-bottom: 2rem;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
    }

    .nav-links {
        width: 80%;
    }
    
    .search-box input {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }
    
    .search-box button {
        padding: 0.7rem 1rem;
    }

    .date-item {
        flex-direction: column;
    }

    .date-item span:last-child {
        margin-top: 0.5rem;
        font-weight: 600;
    }
    
    /* Improve modal on tiny screens */
    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-body {
        max-height: calc(100vh - 180px);
    }
    
    .tab-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }
    
    /* Fix exam cards on small screens */
    .exam-card {
        border-radius: 10px;
    }
    
    .exam-header {
        padding: 1.2rem;
    }
    
    .exam-body {
        padding: 1.2rem;
    }
    
    .exam-footer {
        padding: 0.8rem 1.2rem;
    }
    
    /* Improve feature cards on small screens */
    .feature-card, .category-card {
        padding: 1.5rem;
    }
    
    .feature-icon, .category-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 1rem;
    }
    
    .feature-icon i, .category-icon i {
        font-size: 1.2rem;
    }
}

/* Very Small Screens */
@media screen and (max-width: 375px) {
    .hero h1 {
        font-size: 1.3rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .feature-card h3, .category-card h3 {
        font-size: 1rem;
    }
    
    .nav-links {
        width: 85%;
    }
    
    .nav-links li {
        margin: 1rem 0;
    }
    
    .nav-links a {
        font-size: 1rem;
        padding: 0.6rem;
    }
    
    .logo-link span {
        font-size: 1.2rem;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
    
    .filter-btn {
        font-size: 0.9rem;
        padding: 0.7rem 1.2rem;
    }
    
    .filter-status {
        font-size: 0.9rem;
    }
    
    .exam-title {
        font-size: 1.1rem;
    }
    
    .exam-category {
        font-size: 0.7rem;
    }
    
    .view-details-btn {
        font-size: 0.8rem;
    }
    
    /* Modal content fixes */
    .modal-header {
        padding: 1.3rem;
    }
    
    .modal-header .exam-title {
        font-size: 1.4rem;
    }
    
    .modal-header .conducting-body {
        font-size: 0.9rem;
    }
    
    .modal-body {
        padding: 1.2rem;
    }
    
    .tab-btn {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .tab-btn i {
        margin-right: 0.2rem;
    }
    
    .tab-pane h4 {
        font-size: 1.3rem;
    }
    
    .tab-pane h5 {
        font-size: 1.1rem;
    }
    
    /* Fix scrolling issues on iOS */
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Fix button text wrapping */
    .website-btn, .close-btn {
        white-space: nowrap;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    header, footer, .cta-button, .scroll-indicator, .hero {
        display: none;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .modal-content {
        box-shadow: none;
        margin: 0;
        width: 100%;
    }

    .tab-btn {
        color: #000;
    }

    .tab-btn.active {
        border-bottom-color: #000;
        color: #000;
    }

    .view-details-btn, .close-btn {
        display: none;
    }

    .exam-card {
        page-break-inside: avoid;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
