 :root { 
        --navy: #002147; 
        --gold: #c5a021; 
        --white: #ffffff; 
        --bg: #f4f7f6; 
        --danger: #d9534f; 
        --success: #28a745; 
        --warning: #f0ad4e; 
    }

    
    * {
        box-sizing: border-box;
    }
    
    body { 
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
        background: var(--bg); 
        margin: 0; 
        padding: 0; 
        color: #333; 
        overflow-x: hidden; 
    }
    
    header { 
        background: var(--navy); 
        color: white; 
        padding: 30px 20px; 
        text-align: center; 
        border-bottom: 5px solid var(--gold); 
        box-shadow: 0 4px 10px rgba(0,0,0,0.2); 
    }

    
    .main-layout { 
        display: grid; 
        grid-template-columns: 1fr 320px; 
        gap: 25px; 
        max-width: 1400px; 
        margin: 30px auto; 
        padding: 0 20px; 
    }
    
    .wrapper { 
        background: white; 
        border-radius: 12px; 
        padding: 30px; 
        box-shadow: 0 8px 20px rgba(0,0,0,0.08); 
        min-width: 0; 
        overflow-wrap: break-word;
    }
    
    .sidebar { 
        background: #fff; 
        padding: 25px; 
        border-radius: 12px; 
        box-shadow: 0 8px 20px rgba(0,0,0,0.08); 
        height: fit-content; 
        position: sticky; 
        top: 20px; 
    }

   
    .grid { 
        display: grid; 
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
        gap: 12px; 
        margin-bottom: 25px; 
    }
    
    .subject-box { 
        background: #f8f9fa; 
        padding: 10px; 
        border: 1px solid #e9ecef; 
        border-radius: 8px; 
        transition: 0.3s; 
    }
    
    .subject-box:hover { 
        border-color: var(--gold); 
        background: #fff; 
    }

   
    h3 { 
        color: var(--navy); 
        border-left: 5px solid var(--gold); 
        padding-left: 12px; 
        margin: 30px 0 15px 0; 
        font-size: 1.2rem; 
    }

   
    select { 
        width: 100%; 
        padding: 10px; 
        border-radius: 6px; 
        border: 1px solid #ced4da; 
        font-weight: 600; 
        cursor: pointer; 
    }

    
    .rule-item { 
        margin-bottom: 12px; 
        font-size: 0.9rem; 
        color: #6c757d; 
        display: flex; 
        align-items: center; 
        transition: 0.3s; 
    }
    
    .rule-item.valid { 
        color: var(--success); 
        font-weight: bold; 
    }
    
    .rule-item.valid::before { 
        content: '✓ '; 
        margin-right: 8px; 
        font-size: 1.1rem; 
    }
    
    .rule-item.invalid::before { 
        content: '○ '; 
        margin-right: 8px; 
        font-size: 1.1rem; 
    }

   
    .btn-main { 
        display: block; 
        width: 100%; 
        padding: 18px; 
        background: var(--navy); 
        color: white; 
        border: none; 
        border-radius: 10px; 
        font-size: 1.2rem; 
        cursor: pointer; 
        font-weight: bold; 
        margin-top: 25px; 
        transition: 0.3s; 
    }
    
    .btn-main:hover { 
        background: #003366; 
        transform: translateY(-2px); 
        box-shadow: 0 5px 15px rgba(0,0,0,0.2); 
    }

    
    .course-card { 
        border: 1px solid #e0e0e0; 
        padding: 20px; 
        border-radius: 12px; 
        margin-bottom: 15px; 
        border-left: 8px solid #ccc; 
        position: relative; 
        transition: 0.3s; 
        width: 100%; 
        max-width: 100%; 
        overflow: hidden; 
    }
    
    .course-card.eligible { 
        border-left-color: var(--success); 
        background: #f0fff4; 
    }
    
    .course-card.ineligible { 
        border-left-color: var(--danger); 
        opacity: 0.8; 
        background: #fff5f5; 
    }
    
    .fee-tag { 
        background: #e8f5e9; 
        color: #2e7d32; 
        padding: 6px 12px; 
        border-radius: 6px; 
        font-size: 0.85rem; 
        font-weight: bold; 
        display: inline-block; 
        margin-top: 10px; 
        border: 1px solid #c8e6c9; 
    }
    
    .wcp-badge { 
        position: absolute; 
        top: 15px; 
        right: 15px; 
        background: var(--navy); 
        color: white; 
        padding: 5px 12px; 
        border-radius: 6px; 
        font-weight: bold; 
        font-family: monospace; 
        z-index: 10; 
    }

    
    .filter-bar { 
        display: flex; 
        gap: 15px; 
        margin-bottom: 25px; 
        flex-wrap: wrap; 
    }
    
    #courseSearch { 
        flex: 1; 
        padding: 12px 20px; 
        border-radius: 8px; 
        border: 1px solid #ccc; 
        font-size: 1rem; 
        min-width: 200px; 
    }
    
    .stat-banner { 
        background: var(--navy); 
        color: white; 
        padding: 15px; 
        border-radius: 8px; 
        text-align: center; 
        margin-bottom: 20px; 
    }

    
    #pdf-download-btn {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
    }
    
    #pdf-download-btn:disabled {
        opacity: 0.7;
        cursor: not-allowed;
    }
    
    #pdf-temp-container {
        -webkit-user-select: none;
        user-select: none;
    }
    
    .course-card {
        -webkit-overflow-scrolling: touch;
    }

    /* === RESPONSIVE BREAKPOINTS === */
    
    /* Tablet and below */
    @media (max-width: 992px) {
        .main-layout { 
            grid-template-columns: 1fr; 
        }
        .sidebar { 
            position: static !important; 
            order: 2; 
            margin-top: 20px; 
        }
        .wrapper { 
            order: 1; 
        }
    }

    /* Small tablets */
    @media (max-width: 850px) {
        header h1 { 
            font-size: 1.5rem; 
        }
        .sidebar { 
            position: static; 
            order: -1; 
            margin-bottom: 20px;
        }
        .wrapper { 
            padding: 15px; 
        }
        select, .btn-main {
            font-size: 1rem;
            padding: 15px;
        }
    }

    /* Mobile phones */
    @media (max-width: 768px) {
        .main-layout {
            grid-template-columns: 1fr;
            padding: 0 10px; /* Reduce side padding */
            margin: 15px auto;
        }
        .grid {
            grid-template-columns: 1fr 1fr; /* 2 columns on mobile */
        }
        header h1 {
            font-size: 1.4rem; 
        }
        header p {
            font-size: 0.85rem;
        }
        
        /* === CRITICAL: Course Card Mobile Fixes === */
        .course-card {
            padding: 15px;
            padding-top: 45px; /* Make room for badge */
            width: 100%;
            max-width: 100vw; /* Never exceed viewport */
        }
        
        /* Override inline grid styles for mobile */
        .course-card > div[style*="display:grid"] {
            display: flex !important;
            flex-direction: column !important;
            gap: 10px !important;
        }
        
        .course-card h4 {
            font-size: 1rem !important;
            line-height: 1.3;
            margin-right: 0 !important;
            word-wrap: break-word;
        }
        
        .course-card small {
            font-size: 0.8rem;
            display: block;
            word-wrap: break-word;
        }
        
        /* Reposition badge for mobile */
        .wcp-badge { 
            position: absolute; 
            top: 10px; 
            left: 10px; 
            right: auto;
            font-size: 0.75rem;
            padding: 4px 8px;
        }
        
        
        .course-card div[style*="text-align:right"] {
            text-align: left !important;
            margin-top: 10px;
            border-top: 1px dashed #ccc;
            padding-top: 10px;
        }
        
       
        .fee-tag {
            font-size: 0.8rem;
            max-width: 100%;
            word-wrap: break-word;
        }
    }

    
    @media (max-width: 480px) {
        .grid { 
            grid-template-columns: 1fr 1fr; 
        } 
        header h1 { 
            font-size: 1.3rem; 
        }
        .wrapper { 
            padding: 12px; 
            border-radius: 8px;
        }
        .subject-box { 
            padding: 8px; 
        }
        h3 { 
            font-size: 1rem; 
        }
        select { 
            padding: 10px; 
            font-size: 0.9rem; 
        }
        
       
        .course-card {
            padding: 12px;
            padding-top: 40px;
        }
        
        .filter-bar {
            flex-direction: column;
            gap: 10px;
        }
        
        #courseSearch {
            width: 100%;
            min-width: auto;
        }
        
        #btn-best-fit,
        .filter-bar button {
            width: 100%;
        }
    }

    
    @media (max-width: 360px) {
        .grid {
            grid-template-columns: 1fr;
        }
        .course-card h4 {
            font-size: 0.95rem !important;
        }
    }
    .pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 10px 15px;
    border: 1px solid var(--navy);
    background: white;
    color: var(--navy);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.pagination button.active {
    background: var(--navy);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



.eligibility-steps-container {
    display: block !important;
    visibility: visible !important;
    background-color: #f9f9f9;
    border: 2px solid #000080; 
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    width: 90% !important; 
    max-width: 800px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    box-sizing: border-box;
    clear: both; 
}

.steps-heading {
    color: #000080;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 15px;
    text-align: center;
    display: block !important;
}

.step-item {
    font-size: 1.05rem;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.4;
    display: block !important;
}

.step-label {
    color: #B8860B; 
    font-weight: 600;
}


@media only screen and (max-width: 768px) {
    .eligibility-steps-container {
        width: 95% !important;
        padding: 15px !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }
    
    .steps-heading {
        font-size: 1.1rem !important;
    }
    
    .step-item {
        font-size: 0.9rem !important;
    }
}


.site-footer {
    background-color: #000080; 
    color: #ffffff;
    padding: 30px 20px;
    text-align: center;
    font-family: 'Segoe UI', sans-serif;
    margin-top: 40px;
    clear: both;
}

.footer-content p {
    margin-bottom: 15px;
    font-size: 0.95rem;
    opacity: 0.9;
}


.legal-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap; 
}

.legal-links a {
    color: #B8860B;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 5px 10px; 
    transition: color 0.3s ease;
}

.legal-links a:hover {
    color: #ffd700;
    text-decoration: underline;
}


@media screen and (max-width: 600px) {
    .legal-links {
        flex-direction: column; 
        gap: 12px;
    }
    
    .legal-links a {
        font-size: 1rem; 
        display: block;
        border-bottom: 1px solid rgba(184, 134, 11, 0.2); 
        padding-bottom: 8px;
    }

    
    .legal-links a:last-child {
        border-bottom: none;
    }
}


#open-payment-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    filter: grayscale(1) !important;
    transform: none !important; 
}


#open-payment-btn:not(:disabled) {
    opacity: 1 !important;
    cursor: pointer !important;
    filter: none !important;
}

.payment-instruction {
    font-style: italic;
}

@media screen and (max-width: 768px) {
    .main-layout {
        display: flex;
        flex-direction: column; 
    }

    .wrapper {
        order: 1; 
    }

    .sidebar {
        order: 2; 
        width: 100%; 
        margin-top: 30px; 
        padding: 15px;
        box-sizing: border-box;
    }
}


@media screen and (max-width: 480px) {
    #payment-modal h2 {
        font-size: 1.3rem; 
    }
    
    #payment-modal ol {
        text-align: left; 
        font-size: 0.9rem;
        padding-left: 20px;
    }

    #payment-modal p {
        font-size: 0.9rem;
    }

    #payment-modal .btn-main {
        padding: 12px; 
    }
}


.payment-instruction {
    font-style: italic;
    font-size: 0.85rem;
    color: #555;
    margin-top: 15px;
    line-height: 1.4;
    padding: 0 10px; 
}


@media screen and (max-width: 480px) {
    .payment-instruction {
        font-size: 0.8rem; 
        margin-top: 12px;
        line-height: 1.3;
    }
}