/* General Body and Typography */
:root {
    --primary-dark-blue: #1e2a4c;
    --primary-green: #34d399;
    --accent-blue: #3b82f6;
    --background-light: #f8f9fa;
    --card-bg: #ffffff;
    --text-dark: #1f2937;
    --text-light: #6c757d;
    --border-color: #e5e7eb;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    margin: 0;
    line-height: 1.6;
}

h1, h2, h3 {
    font-weight: 700;
    color: var(--primary-dark-blue);
}

p {
    color: var(--text-light);
}

a {
    color: var(--primary-dark-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-blue);
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Header and Navigation */
.header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-img {
    height: 45px;
    width: auto;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-dark-blue);
}

.nav-links a {
    margin-left: 1.5rem;
    font-weight: 500;
}

.telegram-btn {
    background-color: #0088cc;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s ease;
}

.telegram-btn:hover {
    background-color: #0077b3;
    color: white;
}

/* Main Content and Sections */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.main-content {
    max-width: 1000px;
    margin: 0 auto;
}

.text-center {
    text-align: center;
}

.hero-section {
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-size: 2.8rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.exam-category-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (min-width: 992px) {
    .exam-category-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.exam-card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.exam-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.exam-card-logo {
    height: 80px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.exam-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark-blue);
}

.exam-card .btn-check-result {
    background-color: var(--accent-blue);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.exam-card .btn-check-result:hover {
    background-color: #2563eb;
    color: white;
}

/* Form Styles */
.card {
    background-color: var(--card-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-input, .form-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
}

.form-input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Button */
.btn-primary {
    background: var(--primary-green);
    color: white;
    font-weight: 700;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 211, 153, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #2cb98a;
    box-shadow: 0 6px 20px rgba(52, 211, 153, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Status and Messages */
.status-section {
    text-align: center;
    padding: 2rem;
}

.loader {
    border: 4px solid #e9ecef;
    border-radius: 50%;
    border-top: 4px solid var(--primary-green);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: var(--error-text);
    font-weight: 600;
    margin-top: 1.5rem;
    text-align: center;
    display: block;
    background-color: var(--error-bg);
    padding: 1rem;
    border-radius: 8px;
}

.hidden {
    display: none;
}

/* Result Page Table */
.single-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
    background-color: #fff;
}
.single-result-table th, .single-result-table td {
    border: 1px solid var(--border-color);
    padding: 0.85rem;
    text-align: left;
    vertical-align: middle;
}
.single-result-table thead th {
    background-color: var(--primary-dark-blue);
    color: white;
    font-size: 1.2rem;
    text-align: center;
}
.single-result-table .section-header td {
    background-color: var(--background-light);
    font-weight: 700;
    color: var(--primary-dark-blue);
    text-align: center;
}
.single-result-table .label-cell {
    font-weight: 600;
}
.single-result-table .rank-cell {
    text-align: center;
}
.single-result-table .score-breakdown-header th {
    background-color: var(--accent-blue);
    color: white;
    text-align: center;
}
.single-result-table .score-breakdown-body td {
    text-align: center;
}
.single-result-table .score-breakdown-body td:first-child {
    text-align: left;
}
.single-result-table .ranks-header th {
    background-color: #6c757d;
    color: white;
    text-align: center;
}

/* Footer */
.footer {
    background-color: var(--primary-dark-blue);
    color: #a0aec0;
    margin-top: 5rem;
    padding: 3rem 1.5rem 2rem;
    border-top: 4px solid var(--primary-green);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 2rem;
    flex-wrap: wrap;
}

.footer h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 1.25rem;
}

.footer-links a {
    color: #a0aec0;
    text-decoration: none;
    transition: color 0.3s ease;
    margin-left: 1.5rem;
}

.footer-links a:hover {
    color: var(--primary-green);
}

.footer-socials a {
    color: #a0aec0;
    font-size: 1.5rem;
    margin-left: 1rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-socials a:hover {
    color: var(--primary-green);
    transform: scale(1.1);
}

.footer-copy {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    font-size: 0.9rem;
    color: #718096;
    border-top: 1px solid #2d3748;
}

/* Other utility classes */
.popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6); z-index: 2000; display: flex;
    justify-content: center; align-items: center; backdrop-filter: blur(1px);
}
.popup-card {
    background-color: var(--card-bg); padding: 2.5rem; border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); width: 90%; max-width: 500px;
    text-align: center; border-top: 4px solid var(--primary-green); position: relative;
}
.popup-card h2 { margin-top: 0; margin-bottom: 1rem; color: var(--primary-dark-blue); }
.popup-card p { color: var(--text-light); margin-bottom: 2rem; font-size: 1.1rem; line-height: 1.6; }
.popup-card .btn-popup-action { display: inline-block; width: 100%; box-sizing: border-box; padding: 1rem; font-size: 1.2rem; }
.popup-close-wrapper { margin-top: 1rem; text-align: center; }
.popup-close-btn-main { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 0.9rem; text-decoration: underline; padding: 0.5rem; }
.popup-close-btn-main:hover { color: var(--text-dark); }

/* --- RESPONSIVE STYLES FOR ALL PAGES EXCEPT result.php --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .hero-section h1 { font-size: 2.2rem; }
    .logo-text { display: none; }
    .card { padding: 1.5rem; }

    /* Responsive Footer */
    .footer-content { 
        flex-direction: column; 
        gap: 1.5rem; 
        align-items: center; 
        text-align: center;
    }
    .footer-links a {
        margin: 0 0.5rem;
    }
    .footer-socials a {
        margin: 0 0.75rem;
    }
}
