:root {
    --primary: #3498db;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --success: #2ecc71;
    --error: #e74c3c;
    --neutral: #95a5a6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0 auto;
    background: linear-gradient(135deg, #717277 0%, #764ba2 100%);
    justify-content: space-between;
    align-items: center;
}

html {
    scroll-behavior: smooth;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
    max-width: 900px;
    width: 100%;
}

#quiz-container {
    width: 90%;
}

::-webkit-scrollbar {
    width: 6px;
    height: 12px;
    position: sticky;
}
::-webkit-scrollbar-track {
    background: #f1f1f100; /* Background of the scrollbar track */
}
::-webkit-scrollbar-thumb {
    background: #888; /* Color of the scrollbar thumb */
    border-radius: 10px; /* Rounded corners for the thumb */
}
::-webkit-scrollbar-thumb:hover {
    background: #555; /* Color of the thumb on hover */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

header {
    background-color: var(--primary);
    display: flex;
    justify-content: space-around;
    align-items: center;
    color: white;
    width: 100%;
    text-align: center;
    margin-top: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo {
    height: 60px;
    margin-right: 15px;
}

.logo:hover {
    cursor: pointer;
}

header h1:hover {
    cursor: pointer;
}

#visitor-counter {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
}

.btn {
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-decoration: none;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}


.btn-answers {
  display: inline-block;
  background-color: #4A90E2;
  color: white;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.btn-answers:hover,
.btn-answers:focus {
  background-color: #357ABD;
  box-shadow: 0 6px 18px rgba(53, 122, 189, 0.5);
}

.btn-answers:active {
  background-color: #2C5AA0;
  box-shadow: 0 2px 6px rgba(44, 90, 160, 0.7);
  transform: translateY(1px);
}

.btn-answers:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.6);
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 25px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.page-section {
    background: rgba(245,245,245,0.9);
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.page-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.3s ease;
}

.page-header:hover {
    background: linear-gradient(135deg, #43a3f5 0%, #00e8f5 100%);
}

.toggle-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.page-header.collapsed .toggle-icon {
    transform: rotate(180deg);
}

.page-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.page-content.expanded {
    max-height: 10000px;
}

.question-container {
    border-bottom: 1px solid #f0f0f0;
    padding: 15px 20px;
}

.question-container:last-child {
    border-bottom: none;
}

.question-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    line-height: 1.4;
}

.option {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.option.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
}

.option.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #dc3545;
    color: #721c24;
}

.indicator {
    font-weight: bold;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.correct .indicator {
    color: #28a745;
}

.incorrect .indicator {
    color: #dc3545;
}

.search-container {
    position: fixed;
    margin-bottom: 20px;
    z-index: 1000;
    top: 100px;
    left: 10px;
    width: fit-content;
}

.search-box {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
}

#search-input {
    flex: 1;
    display: none;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

#search-input:focus {
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.search-navigation {
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 12px;
}

.search-navigation button {
    background: #4facfe;
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

.search-navigation button:hover {
    background: #43a3f5;
}

.search-navigation button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#search-counter {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.highlight {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.search-match {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border: 2px solid #17a2b8 !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(23, 162, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0); }
}

.stats {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    width: 80%;
    padding: 10px 25px;
    margin: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stats h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #4facfe;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #2e2e2e;
    margin-top: 2px;
}

@media (max-width: 768px) {
    h1 {
        font-size: 20px;
    }

    .logo {
        height: 50px;
    }

    .header-actions {
        display: flex;
        flex-direction: column;
        gap: 0;
        scale: 0.8;
    }

    .btn-answers {
        padding: 8px 16px;
    }

    .search-box {
        flex-direction: column;
        gap: 10px;
    }

    .search-actions {
        display: flex;
        flex-direction: row;
        gap: 5px;
    }
    
    #search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .page-header {
        padding: 12px 15px;
        font-size: 15px;
    }
    
    .question-container {
        padding: 12px 15px;
    }
    
    .question-title {
        font-size: 14px;
    }
    
    .option {
        font-size: 13px;
        padding: 6px 10px;
    }
}

.course-selector {
    background: rgba(233, 226, 226, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.selector-box {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.selector-box label {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

#course-select {
    flex: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
    background: white;
    width: 90%;
    max-width: 340px;
    align-self: center;
}

#course-select:focus {
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

@media (max-width: 768px) {
    .selector-box {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .course-selector {
        padding: 0;
        width: 80%;
    }
}

.explanation {
    margin-top: 15px;
    padding: 10px;
    background-color: #e9ecef;
    border-left: 4px solid #007bff;
    border-radius: 0 4px 4px 0;
}

.explanation strong {
    color: #007bff;
}

footer {
    background-color: var(--dark);
    color: white;
    text-align: center;
    width: 100%;
    padding: 0.5rem 0;
}