:root {
    /* Color Palette: Navy Blue & Gold */
    --primary: #0a2342; /* Navy Blue */
    --primary-light: #173f6b;
    --accent: #d4af37; /* Gold */
    --accent-hover: #f1c944;
    --bg-color: #f4f6f9;
    --text-main: #333;
    --text-light: #666;
    --white: #ffffff;
    --error: #d9534f;
    --success: #5cb85c;
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    background-color: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 2rem 1rem;
    border-bottom: 4px solid var(--accent);
}

.main-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.main-header p {
    color: #cbd5e1;
}

/* Container */
.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
    width: 100%;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); /* Very light shadow for performance */
    margin-bottom: 2rem;
}

/* Search Form */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary);
}

.input-group input {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1.1rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.cf-turnstile {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-light);
}

.btn-primary:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.error-msg {
    color: var(--error);
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
}

/* Results Section */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.student-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    color: white;
    background-color: var(--success);
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.score-item {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.score-item.gold-highlight {
    background-color: #fffbeb;
    border-color: var(--accent);
}

.score-item .label {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.score-item .value {
    display: block;
    font-size: 1.5rem;
    color: var(--primary);
}

.score-item.gold-highlight .value {
    color: #b48600; /* Darker gold for contrast */
}

.details-grid {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 6px;
    margin-bottom: 2rem;
}

.detail-row {
    display: flex;
    margin-bottom: 0.8rem;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 0.4rem;
}

.detail-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.detail-row span {
    width: 120px;
    color: var(--text-light);
}

.detail-row strong {
    flex: 1;
    color: var(--text-main);
}

.ranks-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    text-align: center;
}

.ranks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.rank-item {
    text-align: center;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border-radius: 6px;
}

.rank-item .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.3rem;
}

.rank-item .value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    background-color: var(--white);
    border-top: 1px solid #e2e8f0;
}

/* Utilities */
.hidden {
    display: none !important;
}

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

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

@media (max-width: 600px) {
    .scores-grid {
        grid-template-columns: 1fr;
    }
}

/* Promo Section */
.promo-section {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

/* Telegram Button */
.btn-telegram {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #0088cc 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 136, 204, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 136, 204, 0.3);
    color: white;
}

/* Ad Card */
.ad-card {
    width: 100%;
    margin-bottom: 0;
    text-align: center;
    border: 2px dashed #cbd5e1;
    background-color: #f8fafc;
    box-shadow: none;
}

.ad-card h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.ad-card p {
    color: var(--text-light);
    margin-bottom: 1.2rem;
}

.btn-ad-contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.2s;
}

.btn-ad-contact:hover {
    background-color: var(--primary-light);
    color: white;
}
