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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Welcome Screen */
.header-logo {
    text-align: center;
    margin-bottom: 30px;
}

.header-logo i {
    font-size: 60px;
    color: #667eea;
    margin-bottom: 10px;
}

.header-logo h1 {
    color: #667eea;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
}

.welcome-content {
    text-align: center;
}

.welcome-content h2 {
    color: #333;
    font-size: 36px;
    margin-bottom: 10px;
}

.welcome-content h3 {
    color: #764ba2;
    font-size: 24px;
    margin-bottom: 30px;
}

.test-info {
    display: flex;
    justify-content: space-around;
    margin: 40px 0;
    gap: 20px;
}

.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    flex: 1;
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
}

.info-card i {
    font-size: 32px;
    margin-bottom: 10px;
}

.info-card p {
    font-size: 16px;
    font-weight: 600;
}

.instructions {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    text-align: left;
    margin: 30px 0;
    border-left: 5px solid #667eea;
}

.instructions h4 {
    color: #667eea;
    font-size: 20px;
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin: 10px 0;
    padding-left: 30px;
    position: relative;
    color: #555;
}

.instructions li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
    font-size: 18px;
}

.name-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    margin: 20px 0;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease;
}

.name-input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary i {
    margin-right: 10px;
}

/* Test Screen */
.test-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.school-name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

.school-name i {
    margin-right: 10px;
}

.student-info {
    font-size: 16px;
    font-weight: 500;
}

.student-info i {
    margin-right: 8px;
}

/* Progress Bar */
.progress-container {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 10%;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

/* Question Pills */
.question-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    justify-content: center;
}

.question-pill {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.question-pill:hover {
    transform: scale(1.1);
}

.question-pill.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #fff;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.question-pill.answered {
    background: #4caf50;
    color: white;
}

.question-pill.skipped {
    background: #ff9800;
    color: white;
}

/* Question Container */
.question-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 20px;
    min-height: 400px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.question {
    display: none;
}

.question.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.question-number {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
}

.question-type {
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
    line-height: 1.6;
}

.question-subtext {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

/* Multiple Choice Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    font-size: 16px;
}

.option:hover {
    background: #e9ecef;
    transform: translateX(10px);
}

.option input[type="radio"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option.selected {
    background: #e7f3ff;
    border-color: #667eea;
    font-weight: 600;
}

/* Descriptive Answer */
.descriptive-answer {
    margin-top: 20px;
}

.descriptive-answer textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.descriptive-answer textarea:focus {
    outline: none;
    border-color: #667eea;
}

.table-input {
    width: 100%;
    margin: 20px 0;
}

.table-input table {
    width: 100%;
    border-collapse: collapse;
}

.table-input th,
.table-input td {
    padding: 15px;
    border: 2px solid #e0e0e0;
    text-align: left;
}

.table-input th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.table-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}

.table-input input:focus {
    outline: none;
    border-color: #667eea;
}

.sub-question {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.sub-question label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.sub-question input,
.sub-question textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}

.sub-question input:focus,
.sub-question textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 20px;
}

.btn-nav,
.btn-skip,
.btn-submit {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-nav:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-skip {
    background: #ff9800;
    color: white;
}

.btn-skip:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.btn-submit {
    background: #4caf50;
    color: white;
    flex: 1;
}

.btn-submit:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* Results Screen */
.results-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.trophy-icon {
    font-size: 80px;
    color: #ffd700;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.results-header h1 {
    color: #667eea;
    font-size: 42px;
    margin-bottom: 10px;
}

.results-header h2 {
    color: #764ba2;
    font-size: 24px;
}

/* Score Card */
.score-card {
    text-align: center;
    margin: 40px 0;
}

.score-circle {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.score-circle svg {
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 10;
}

.score-progress {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 10;
    stroke-dasharray: 565;
    stroke-dashoffset: 565;
    transition: stroke-dashoffset 2s ease;
    stroke-linecap: round;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-text span {
    display: block;
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
}

.score-text p {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
}

.score-message {
    font-size: 24px;
    font-weight: 600;
    margin-top: 20px;
}

.score-message.excellent {
    color: #4caf50;
}

.score-message.good {
    color: #2196f3;
}

.score-message.average {
    color: #ff9800;
}

.score-message.needs-improvement {
    color: #f44336;
}

/* Results Summary */
.results-summary {
    display: flex;
    gap: 20px;
    margin: 40px 0;
}

.summary-card {
    flex: 1;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.summary-card.correct {
    background: linear-gradient(135deg, #4caf50, #81c784);
    color: white;
}

.summary-card.incorrect {
    background: linear-gradient(135deg, #f44336, #e57373);
    color: white;
}

.summary-card i {
    font-size: 48px;
    margin-bottom: 15px;
}

.summary-card h3 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
}

.summary-card p {
    font-size: 18px;
    font-weight: 500;
}

/* Review Section */
.review-section {
    margin: 40px 0;
}

.review-question {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    border-left: 5px solid #667eea;
}

.review-question.correct {
    border-left-color: #4caf50;
    background: #f1f8f4;
}

.review-question.incorrect {
    border-left-color: #f44336;
    background: #fef5f5;
}

.review-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.review-question-title {
    font-weight: 600;
    font-size: 18px;
    color: #333;
}

.review-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.review-status.correct {
    background: #4caf50;
    color: white;
}

.review-status.incorrect {
    background: #f44336;
    color: white;
}

.review-content {
    font-size: 16px;
    color: #555;
    line-height: 1.8;
}

.review-content p {
    margin: 10px 0;
}

.review-content strong {
    color: #333;
}

.answer-comparison {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
}

.your-answer {
    margin-bottom: 10px;
}

.correct-answer {
    color: #4caf50;
    font-weight: 600;
}

/* Email Status */
.email-status {
    text-align: center;
    margin: 30px 0;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.email-status.sending {
    display: block;
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

.email-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.email-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.email-status i {
    margin-right: 10px;
}

/* Action Buttons */
.action-buttons {
    text-align: center;
    margin-top: 40px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Confetti Animation */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .test-info {
        flex-direction: column;
    }

    .welcome-content h2 {
        font-size: 28px;
    }

    .test-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .question-pills {
        justify-content: center;
    }

    .question-container {
        padding: 20px;
    }

    .navigation-buttons {
        flex-wrap: wrap;
    }

    .results-summary {
        flex-direction: column;
    }

    .score-text span {
        font-size: 36px;
    }
}

/* Formula Reference Box */
.formula-box {
    background: #fff9e6;
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.formula-box h4 {
    color: #ff9800;
    margin-bottom: 10px;
    font-size: 18px;
}

.formula-box ul {
    list-style: none;
    padding: 0;
}

.formula-box li {
    margin: 8px 0;
    color: #555;
    font-family: 'Courier New', monospace;
}

/* Timer Display */
.timer-display {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
}

.timer-display i {
    margin-right: 8px;
}

/* Ranking Screen Styles */
.ranking-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ranking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

.btn-back {
    background: #f8f9fa;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-back:hover {
    background: #667eea;
    color: white;
    transform: translateX(-5px);
}

.ranking-title {
    text-align: center;
    flex: 1;
}

.ranking-title i {
    font-size: 48px;
    color: #ffd700;
    margin-bottom: 10px;
}

.ranking-title h1 {
    color: #667eea;
    font-size: 36px;
    margin: 10px 0;
}

.ranking-title p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Ranking Stats */
.ranking-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
}

.stat-card p {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Ranking Table */
.ranking-table-container {
    overflow-x: auto;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.ranking-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ranking-table th {
    padding: 18px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.ranking-table th:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ranking-table th i {
    margin-left: 5px;
    font-size: 12px;
    opacity: 0.7;
}

.ranking-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.3s ease;
}

.ranking-table tbody tr:hover {
    background: #f8f9fa;
}

.ranking-table tbody tr.rank-1 {
    background: linear-gradient(90deg, #ffd70010, transparent);
    border-left: 4px solid #ffd700;
}

.ranking-table tbody tr.rank-2 {
    background: linear-gradient(90deg, #c0c0c010, transparent);
    border-left: 4px solid #c0c0c0;
}

.ranking-table tbody tr.rank-3 {
    background: linear-gradient(90deg, #cd7f3210, transparent);
    border-left: 4px solid #cd7f32;
}

.ranking-table td {
    padding: 15px;
    font-size: 15px;
    color: #333;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #000;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
}

.rank-badge.silver {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #000;
    box-shadow: 0 3px 10px rgba(192, 192, 192, 0.4);
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32, #e9a96f);
    color: #fff;
    box-shadow: 0 3px 10px rgba(205, 127, 50, 0.4);
}

.rank-badge.regular {
    background: #e0e0e0;
    color: #666;
}

.score-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.score-badge.excellent {
    background: #4caf50;
    color: white;
}

.score-badge.good {
    background: #2196f3;
    color: white;
}

.score-badge.average {
    background: #ff9800;
    color: white;
}

.score-badge.poor {
    background: #f44336;
    color: white;
}

.correct-badge {
    color: #4caf50;
    font-weight: 600;
}

.incorrect-badge {
    color: #f44336;
    font-weight: 600;
}

.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #667eea;
}

.time-badge.fastest {
    background: #e7f3ff;
    padding: 5px 10px;
    border-radius: 15px;
}

.date-text {
    color: #666;
    font-size: 13px;
}

/* Empty State */
.empty-ranking {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-ranking i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-ranking h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #666;
}

.empty-ranking p {
    font-size: 16px;
}
