/* Base & Reset */
:root {
    --primary-color: #102758;
    --primary-light: #e6ebf5;
    --secondary-color: #F29400;
    --secondary-light: #fef4e5;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --white: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-family: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f4f6fa 0%, var(--primary-light) 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 20px rgba(16, 39, 88, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 45px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Main Container */
.main-container {
    flex: 1;
    max-width: 1000px;
    margin: 3rem auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* Search Section Hero */
.hero-text {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.hero-text h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
    letter-spacing: -1px;
}

.highlight {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Card */
.search-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 3.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(16, 39, 88, 0.15), 0 0 0 1px rgba(255,255,255,0.6);
    max-width: 650px;
    margin: 0 auto;
    animation: fadeIn 1s ease-out;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    height: 60px;
    padding: 0 1.5rem;
    font-size: 1.15rem;
    font-weight: 500;
    font-family: var(--font-family);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.3s ease;
    background-color: var(--white);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.input-group input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(242, 148, 0, 0.15);
}

.btn-primary {
    width: 100%;
    height: 60px;
    background: linear-gradient(90deg, var(--primary-color), #1b3874);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 15px rgba(16, 39, 88, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(90deg, #1b3874, var(--primary-color));
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(16, 39, 88, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-text-only {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
    font-family: var(--font-family);
}

.btn-text-only:hover {
    color: var(--text-dark);
}

.error-message {
    color: #ef4444;
    background: #fef2f2;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    text-align: center;
    border-left: 4px solid #ef4444;
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   Selection List Styles
   ========================================= */
.selection-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.selection-card-btn {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.selection-card-btn:hover {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(16, 39, 88, 0.1);
    transform: translateY(-2px);
}

.selection-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.selection-subject {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.selection-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(242, 148, 0, 0.1);
    color: var(--accent-orange);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    align-self: flex-start;
    margin-top: 0.5rem;
}

/* =========================================
   Responsive Design
   ========================================= */

/* Result Section */
.result-section {
    animation: slideUp 0.6s ease-out;
}

.result-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 4rem 3rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(16, 39, 88, 0.15), 0 0 0 1px rgba(255,255,255,0.6);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.result-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.result-portal-title {
    font-size: 1.4rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.name-rank-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.student-name {
    font-size: 2.8rem;
    color: var(--primary-color);
    line-height: 1.2;
    font-weight: 700;
    margin: 0;
}

.top-rank-badge {
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(242, 148, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.score-showcase {
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 2.5rem;
}

.score-heading {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 0.2rem;
}

.score-percentage {
    color: var(--primary-color);
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.05);
}

/* Student Details List */
.student-details-list {
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    padding: 1.2rem 1.5rem;
    background: rgba(230, 235, 245, 0.4);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
}

.detail-label {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-dark);
    font-size: 1.15rem;
    font-weight: 600;
}

/* Reward Section */
.reward-section {
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(255, 242, 234, 0.5) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.zonal-reward {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed #cbd5e1;
}

.zonal-reward h3 {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cash-reward {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary-color);
    text-shadow: 0 2px 4px rgba(255, 107, 0, 0.2);
}

.additional-benefits h4 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.additional-benefits ul {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.additional-benefits li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.additional-benefits li::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #d1fae5;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 0.8rem;
}

/* Congratulation Message */
.congratulations-message {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-dark);
    font-style: italic;
    margin-bottom: 3rem;
    padding: 0 2rem;
}


/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.download-group {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    width: 100%;
}

.btn-download {
    height: 55px;
    padding: 0 1.2rem;
    background: linear-gradient(90deg, var(--secondary-color), #d98000);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 15px rgba(242, 148, 0, 0.3);
    text-decoration: none;
    white-space: nowrap;
    flex: 1;
    max-width: 250px;
}

.btn-download:hover {
    background: linear-gradient(90deg, #d98000, var(--secondary-color));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(242, 148, 0, 0.4);
    color: var(--white);
}

.btn-download.disabled-btn {
    background: #cbd5e1;
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    pointer-events: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

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

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .search-card {
        padding: 2rem 1.5rem;
    }
    
    .input-group input {
        font-size: 0.95rem; /* Stop placeholder truncation */
        padding: 0 1rem;
    }
    
    .btn-primary {
        font-size: 1.1rem;
    }
    
    .hero-text h1 {
        font-size: 2.2rem;
    }
    
    .result-card {
        padding: 2rem 1.5rem;
    }
    
    .student-name {
        font-size: 2.2rem;
    }
    
    .score-percentage {
        font-size: 2.8rem;
    }

    .additional-benefits ul {
        grid-template-columns: 1fr;
    }
    
    .download-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-download {
        max-width: 100%;
        width: 100%;
    }
}

/* PDF Generation Resets */
.generating-pdf,
.generating-pdf * {
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    transform: none !important;
    animation: none !important;
    overflow: visible !important;
}

.generating-pdf {
    width: 800px !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 1.5rem 3rem !important;
    background: #ffffff !important;
    border: none !important;
    border-radius: 0 !important;
    height: auto !important;
}

/* Compress vertical space to ensure it fits on 1 page */
.generating-pdf .result-header,
.generating-pdf .score-showcase,
.generating-pdf .student-details-list,
.generating-pdf .reward-section {
    margin-bottom: 1.2rem !important;
}

.generating-pdf .result-header {
    padding-bottom: 0.8rem !important;
}

.generating-pdf .detail-row {
    padding: 0.8rem 1.2rem !important;
    gap: 0.5rem !important;
}

.generating-pdf .student-name {
    font-size: 2.2rem !important;
}

.generating-pdf .score-percentage {
    font-size: 2.8rem !important;
}

.generating-pdf .cash-reward {
    font-size: 1.6rem !important;
}

.generating-pdf .score-showcase {
    background-color: #f4f6fa !important;
    border: 2px solid #e2e8f0 !important;
    padding: 1rem !important;
}

.generating-pdf .reward-section {
    background-color: #fef4e5 !important;
    border: 2px solid #F29400 !important;
    padding: 1.2rem !important;
}

.generating-pdf::before,
.generating-pdf .result-card::before {
    display: none !important;
}
