/* --- CLEAN & BRIGHT DESIGN SYSTEM --- */
:root {
    --bg-page: #ffffff;          
    --bg-card: #ffffff;          
    --accent-blue: #0077b6;      /* Sapphire Blue */
    --accent-light: #f0f9ff;     /* Light blue accent tint */
    --text-main: #0f172a;         
    --text-muted: #475569;        
    --border-color: #e2e8f0;      
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --search-shadow: 0 12px 30px rgba(0, 119, 182, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.discovery-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    width: 100%;
    overflow-x: hidden;
    flex: 1;
    min-height: 100vh;
}

/* --- SEARCH SECTION --- */
.search-container {
    width: 100%;
    max-width: 750px;
    text-align: center;
    margin-top: 12vh;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-container.results-active {
    margin-top: 2vh;
}

.search-container h1 {
    font-size: 2.6rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.2;
}

.search-container h1 span {
    color: var(--accent-blue);
}

.search-container p {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
    font-weight: 500;
}

.search-box-positioner {
    position: relative;
    width: 100%;
    text-align: left;
}

/* Base Desktop Layout */
.search-box-wrapper {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 0.4rem 0.4rem 0.4rem 1.75rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.search-box-wrapper:hover {
    border-color: #cbd5e1;
}

.search-box-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--search-shadow);
}

.search-icon {
    color: var(--accent-blue);
    margin-right: 1rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0 !important;
    margin: 0 !important;
    height: 2.2rem !important;
    line-height: 2.2rem !important;
    width: 100%;
}

.search-input:focus,
.search-input:active,
.search-input:focus-visible {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-button {
    background: var(--accent-blue);
    color: #ffffff;
    border: none;
    outline: none;
    padding: 0.9rem 2.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.search-button:hover {
    background: #005f92;
    transform: translateY(-1px);
}

/* --- THE RECOMMENDATIONS CARD LIST --- */
.recommendations-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    z-index: 999;
    display: none; 
    flex-direction: column;
    gap: 10px;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow-y: visible;
}

/* Force flex layout when JS sets style.display = 'block' */
.recommendations-dropdown[style*="display: block"] {
    display: flex !important;
}

.dropdown-item {
    padding: 1.1rem 1.5rem;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-item .col-name { 
    font-weight: 700; 
}

.dropdown-item .col-loc { 
    font-size: 0.82rem; 
    color: var(--text-muted); 
    margin-top: 0.2rem; 
    font-weight: 500; 
}

.dropdown-item:hover, .dropdown-item.active { 
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background-color: #ffffff; 
}

.dropdown-item:hover .col-name, .dropdown-item.active .col-name { 
    color: var(--accent-blue); 
}

/* --- SYSTEM ERROR MESSAGE ALERT --- */
.error-message {
    width: 100%;
    max-width: 850px;
    margin-top: 2rem;
    padding: 1rem 1.5rem;
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 12px;
    font-weight: 600;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

/* --- RESULT DISPLAY CARD --- */
.results-container {
    width: 100%;
    max-width: 850px;
    margin-top: 3rem;
    display: none; 
    animation: cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards slideUpReveal;
}

@keyframes slideUpReveal {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.college-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}

.college-header {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.college-title {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    flex: 1;
    line-height: 1.2;
}

.code-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.university-line {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    margin-top: 0.4rem;
    margin-bottom: 0.75rem;
}

.credentials-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.tag-badge {
    font-size: 0.8rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid var(--border-color);
}
.tag-badge.blue { background: var(--accent-light); color: var(--accent-blue); border-color: transparent; }
.tag-badge.gold { background: #fef9c3; color: #854d0e; border-color: transparent; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.metric-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    text-align: center;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-blue);
}

.info-section {
    margin-bottom: 2.5rem;
}

.info-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-left: 4px solid var(--accent-blue);
    padding-left: 0.75rem;
}

.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cutoff-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap; 
}

.cutoff-table th, .cutoff-table td {
    padding: 0.85rem 1rem;
    text-align: left;
}

.cutoff-table th {
    background-color: var(--accent-light);
    color: var(--accent-blue);
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.cutoff-table td {
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.address-section {
    margin-top: 2rem; 
    margin-bottom: 0;
}

.footer-address {
    background: #f8fafc;
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer-address p {
    margin-bottom: 0.5rem;
}

.footer-address p:last-child {
    margin-bottom: 0;
}

/* --- 📱 RESPONSIVE DESIGN MEDIA QUERIES --- */

@media (max-width: 768px) {
    header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(255, 255, 255, 0.98) !important ;
        z-index: 9999 !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important ;
    }
    .discovery-page-wrapper {
        padding-top: 5.5rem !important;
    }
    .search-container h1 {
        font-size: 2.1rem;
    }
    .college-card {
        padding: 1.75rem;
    }
    .college-title {
        font-size: 1.7rem;
    }
}

/* Small Mobile Devices (Portrait Optimization) */
@media (max-width: 580px) {
    .discovery-page-wrapper {
        padding: 1.5rem 1rem;
    }

    .search-container {
        margin-top: 5vh;
    }

    .search-container h1 {
        font-size: 1.95rem;
        letter-spacing: -0.02em;
    }

    .search-container p {
        font-size: 0.95rem;
        margin-bottom: 1.75rem;
    }

    /* PREMIUM MOBILE SEARCH DESIGN */
    .search-box-wrapper {
        padding: 0.35rem 0.35rem 0.35rem 1.1rem;
        border-radius: 30px;
        background: #ffffff;
        border-color: #cbd5e1;
    }

    .search-icon {
        margin-right: 0.6rem;
        color: #94a3b8;
    }
    
    .search-icon svg {
        width: 18px;
        height: 18px;
    }

    .search-input {
        font-size: 1rem;
        padding: 0 !important;
        margin: 0 !important;
        height: 1.8rem !important;
        line-height: 1.8rem !important;
    }

    .search-button {
        padding: 0.75rem 1.4rem;
        border-radius: 24px;
        font-size: 0.95rem;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 119, 182, 0.2);
    }

    /* Result Cards scaling adjustment */
    .college-card {
        padding: 1.25rem;
        border-radius: 20px;
    }

    .title-row {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .college-title {
        font-size: 1.45rem;
    }

    .code-badge {
        font-size: 0.8rem;
        padding: 0.25rem 0.6rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .metric-item {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }
}