
/* ==================== CSS Variables & Reset ==================== */
:root {
    --primary-color: #00d4ff;
    --primary-dark: #00a8cc;
    --secondary-color: #ff006e;
    --success-color: #00ff88;
    --warning-color: #ffb300;
    --danger-color: #ff4757;
    
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    
    --border-color: #30363d;
    --shadow-sm: 0 3px 10px rgba(0, 212, 255, 0.1);
    --shadow-md: 0 8px 24px rgba(0, 212, 255, 0.15);
    --shadow-lg: 0 15px 40px rgba(0, 212, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ==================== Navbar Styles ==================== */
.navbar {
    width: 250px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 30px 20px;
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: all 0.3s ease;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: translateX(5px);
}

.navbar-brand h2 {
    font-size: 20px;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.navbar-brand i {
    font-size: 24px;
    color: var(--primary-color);
}

.navbar ul li {
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.navbar ul li a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.navbar ul li a:hover,
.navbar ul li a.active {
    color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    transform: translateX(8px);
    box-shadow: inset -3px 0 0 var(--primary-color);
}

.navbar ul li a i {
    font-size: 18px;
}

.btn-language {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.btn-language:hover {
    color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    transform: translateX(8px);
    box-shadow: inset -3px 0 0 var(--primary-color);
}

.btn-language i {
    font-size: 18px;
}

/* ==================== Main Content ==================== */
.container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.8s ease-out;
    background: linear-gradient(135deg, #0f1419 0%, #161a20 100%);
    min-height: 100vh;
}

.welcome-section {
    text-align: center;
    margin-bottom: 50px;
    animation: slideDown 0.6s ease-out;
}

.title {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* ==================== Form Styles ==================== */
.form-container {
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.6s ease-out;
}

#startForm {
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.input-group input {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #2d333b;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    min-height: 48px;
}

.input-group input::placeholder {
    color: #a0aec0;
    opacity: 0.7;
}

input[type="text"]::placeholder {
    color: #a0aec0;
    opacity: 0.7;
}

.input-group input:focus {
    border-color: var(--primary-color);
    background: var(--bg-hover);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* ==================== Category Section ==================== */
.category-section,
.difficulty-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-section label,
.difficulty-section label {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.categories-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: #2d333b;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
    color: #ffffff;
    font-weight: 600;
}

.category-card i {
    font-size: 32px;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.category-card span {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
}

.category-card:hover {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.category-card.active {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.category-card.active i {
    color: var(--primary-color);
    transform: scale(1.2);
}

/* ==================== Difficulty Options ==================== */
.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #2d333b;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    font-weight: 500;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.radio-option span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #ffffff;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
}

.radio-option input[type="radio"]:checked + span {
    color: var(--primary-color);
}

.radio-option input[type="radio"]:checked {
    accent-color: var(--primary-color);
}

/* ==================== Button Styles ==================== */
.btn-start {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow-lg);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 212, 255, 0.3);
}

.btn-start:active {
    transform: translateY(-1px);
}

/* ==================== Quiz Container ==================== */
.quiz-container {
    width: 100%;
    max-width: 600px;
    animation: slideUp 0.6s ease-out;
    position: relative;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 16px;
    background: #2d333b;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.progress-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #404854;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    transition: width 0.3s ease;
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.timer.warning {
    color: var(--warning-color);
    animation: pulse 0.8s ease-in-out infinite;
}

.timer.danger {
    color: var(--danger-color);
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== Question Section ==================== */
.question-section {
    margin-bottom: 20px;
    width: 100%;
    clear: both;
}

.question-number {
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

#question-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.5;
}

/* ==================== Options ==================== */
#options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
    width: 100%;
    clear: both;
}

.option {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #2d333b;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: visible;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
    display: block;
    min-height: auto;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
    text-align: left;
    z-index: 2;
}

.option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.option:hover {
    border-color: var(--primary-color);
    background: var(--bg-hover);
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.option:hover::before {
    transform: scaleY(1);
}

.option.selected {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.3);
    color: #ffffff;
    box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.25), 0 0 10px rgba(0, 212, 255, 0.3);
    font-weight: 700;
}

.option.correct {
    border-color: var(--success-color);
    background: rgba(0, 255, 136, 0.2);
    color: var(--success-color);
}

.option.incorrect {
    border-color: var(--danger-color);
    background: rgba(255, 71, 87, 0.2);
    color: var(--danger-color);
}

/* ==================== Submit Button ==================== */
.quiz-controls {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.btn-submit {
    flex: 1;
    padding: 14px;
    background: var(--primary-color);
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-submit.skip-mode {
    background: #404854;
    border: 2px solid #a0aec0;
    color: #a0aec0;
}

.btn-submit.skip-mode:hover:not(:disabled) {
    background: #505860;
    box-shadow: 0 15px 40px rgba(160, 174, 192, 0.2);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Completion Message ==================== */
.completion-message {
    text-align: center;
    padding: 40px;
    background: #2d333b;
    border-radius: 15px;
    border: 2px solid var(--primary-color);
    display: none;
    animation: slideUp 0.6s ease-out;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    min-width: 300px;
    max-width: 500px;
}

.completion-message.show {
    display: block;
}

.score-display {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
}

.score-feedback {
    font-size: 1.3rem;
    color: #ffffff;
    margin: 20px 0;
    font-weight: 600;
}

.btn-new-game {
    padding: 14px 32px;
    background: var(--success-color);
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    text-transform: uppercase;
}

.btn-new-game:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 255, 136, 0.3);
}

.btn-review {
    padding: 14px 32px;
    background: var(--primary-color);
    color: var(--bg-primary);
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-review:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 212, 255, 0.3);
}

/* ==================== Scores Page ==================== */
.leaderboard {
    width: 100%;
    max-width: 700px;
}

.leaderboard-header {
    margin-bottom: 30px;
    text-align: center;
}

.leaderboard-header h2 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.leaderboard-header p {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 500;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.leaderboard-table thead {
    background: #2d333b;
    border-bottom: 2px solid var(--primary-color);
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: #ffffff;
}

.leaderboard-table tbody tr {
    background: #2d333b;
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: #3a4047;
    transform: translateX(5px);
    box-shadow: inset 0 0 10px rgba(0, 212, 255, 0.1);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-weight: 700;
    color: var(--bg-primary);
    margin-right: 10px;
}

.rank-1 { background: linear-gradient(135deg, #ffd700, #ffed4e); }
.rank-2 { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); }
.rank-3 { background: linear-gradient(135deg, #cd7f32, #daa520); }

.score-badge {
    display: inline-block;
    padding: 5px 12px;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

.btn-delete {
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid #ff3b30;
    color: #ff3b30;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-delete:hover {
    background: rgba(255, 59, 48, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.4);
}

.btn-delete:active {
    transform: scale(0.95);
}

/* Delete Confirmation Modal */
.delete-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.delete-modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--primary-color);
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 15px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-cancel,
.btn-confirm-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-confirm-delete {
    background: #ff3b30;
    color: white;
}

.btn-confirm-delete:hover {
    background: #ff1700;
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.5);
}

.btn-confirm-delete:active {
    transform: scale(0.98);
}

/* Quiz Page - Reduced Padding */
body[data-page="quiz"] .main-content {
    padding: 20px;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .navbar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
        padding: 30px;
    }

    .title {
        font-size: 2.5rem;
    }

    .categories-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .navbar {
        width: 100%;
        height: auto;
        padding: 15px;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .navbar-brand {
        margin-bottom: 15px;
    }

    .navbar-brand h2 {
        font-size: 18px;
    }

    .navbar ul {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .navbar ul li {
        flex: 1;
        min-width: 100px;
        margin-bottom: 0;
    }

    .navbar ul li a {
        flex-direction: column;
        text-align: center;
        padding: 10px;
        font-size: 0.85rem;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .form-container {
        width: 100%;
        max-width: 100%;
    }

    .categories-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .quiz-header {
        gap: 20px;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .navbar ul {
        flex-direction: row;
    }

    .navbar ul li a {
        gap: 5px;
        padding: 8px;
    }

    .title {
        font-size: 1.5rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    .difficulty-options {
        flex-direction: column;
    }

    .leaderboard-table {
        border-collapse: separate;
        border-radius: 0;
        display: block;
        overflow-x: auto;
    }

    .leaderboard-table thead {
        display: none;
    }

    .leaderboard-table tbody {
        display: block;
    }

    .leaderboard-table tbody tr {
        display: block;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 15px;
        background: linear-gradient(135deg, #2d333b 0%, #363c45 100%);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .leaderboard-table tbody tr:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0, 212, 255, 0.2);
    }

    .leaderboard-table td {
        display: block;
        padding: 10px 12px;
        text-align: right;
        border-bottom: none;
        border-left: 4px solid var(--primary-color);
        word-break: break-word;
    }

    .leaderboard-table td:first-child {
        background: rgba(0, 212, 255, 0.1);
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--primary-color);
        border-left: 4px solid var(--primary-color);
    }

    .leaderboard-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 700;
        width: 40%;
        color: #a0aec0;
        text-align: left;
    }

    .rank-badge {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .score-badge {
        padding: 4px 10px;
        font-size: 0.85rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .leaderboard-header h2 {
        font-size: 1.8rem;
    }

    .leaderboard-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .leaderboard-table td:before {
        width: 35%;
        font-size: 0.75rem;
    }

    .rank-badge {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
        margin-right: 5px;
    }

    .score-badge {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    .leaderboard {
        max-width: 100%;
    }
}

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

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== Scrollbar Styling ==================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ==================== Search Page Styles ==================== */
.search-container {
    background: rgba(13, 17, 23, 0.6);
    border-radius: 16px;
    padding: 40px;
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.search-container h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    text-align: center;
}

.search-form-wrapper {
    margin: 30px 0;
}

.search-input-group {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    transition: all 0.3s ease;
}

.search-input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.search-input-group i {
    color: var(--primary-color);
    font-size: 18px;
    margin-right: 12px;
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    padding: 8px;
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: none;
    padding: 0 8px;
}

.btn-clear:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
    outline: none;
}

.filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-filter {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-filter:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

.btn-filter:active {
    transform: translateY(-1px);
}

.search-stats {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 212, 255, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    color: var(--text-secondary);
}

.search-results {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-card {
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.8), rgba(33, 38, 45, 0.8));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    animation: slideUp 0.5s ease forwards;
    opacity: 0;
}

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

.result-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
    transform: translateY(-5px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.result-badges {
    display: flex;
    gap: 10px;
}

.difficulty-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.difficulty-easy {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid #00ff88;
}

.difficulty-medium {
    background: rgba(255, 179, 0, 0.2);
    color: #ffb300;
    border: 1px solid #ffb300;
}

.difficulty-hard {
    background: rgba(255, 71, 87, 0.2);
    color: #ff4757;
    border: 1px solid #ff4757;
}

.category-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-html {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border: 1px solid #ffa500;
}

.category-css {
    background: rgba(33, 150, 243, 0.2);
    color: #2196f3;
    border: 1px solid #2196f3;
}

.category-javascript {
    background: rgba(240, 215, 0, 0.2);
    color: #f0d700;
    border: 1px solid #f0d700;
}

.category-design {
    background: rgba(156, 39, 176, 0.2);
    color: #9c27b0;
    border: 1px solid #9c27b0;
}

.result-match-count {
    font-size: 13px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.result-question {
    margin-bottom: 15px;
}

.result-question h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.6;
}

.result-question h3 mark {
    background: rgba(0, 212, 255, 0.3);
    color: var(--primary-color);
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 700;
}

.result-options {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.result-option:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary-color);
}

.result-option.correct-answer {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    color: #00ff88;
    font-weight: 600;
}

.result-option mark {
    background: rgba(0, 212, 255, 0.3);
    color: var(--primary-color);
    padding: 0 3px;
    border-radius: 2px;
    font-weight: 700;
}

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: var(--bg-primary);
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
}

.result-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.result-explanation {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 64px;
    color: var(--primary-color);
    opacity: 0.3;
    margin-bottom: 20px;
}

.no-results p {
    font-size: 18px;
    margin: 0;
}

.welcome-search {
    padding: 40px 20px;
    text-align: center;
}

.welcome-search i {
    font-size: 80px;
    color: var(--primary-color);
    opacity: 0.5;
    display: block;
    margin-bottom: 20px;
}

.welcome-search h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.welcome-search > p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.search-tips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.tip-item {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}

.tip-item i {
    font-size: 28px;
    color: var(--primary-color);
    display: block;
    margin-bottom: 12px;
}

.tip-item p {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 12px;
}

.tip-item ul {
    list-style: disc;
    padding-left: 20px;
    color: var(--text-secondary);
}

.tip-item li {
    margin-bottom: 8px;
}

#statsContent {
    color: var(--text-secondary);
    font-size: 14px;
}

#statsContent p {
    margin: 5px 0;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    animation: toastSlide 0.3s ease forwards;
}

@keyframes toastSlide {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.toast-success i {
    color: #00ff88;
}

.toast-error {
    border-color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.toast-error i {
    color: #ff4757;
}

.toast-info {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
}

.toast-info i {
    color: var(--primary-color);
}

.toast-warning {
    border-color: #ffb300;
    background: rgba(255, 179, 0, 0.1);
}

.toast-warning i {
    color: #ffb300;
}

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

    .search-container h1 {
        font-size: 2rem;
    }

    .search-filters {
        grid-template-columns: 1fr;
    }

    .search-tips {
        grid-template-columns: 1fr;
    }

    .result-card {
        padding: 15px;
    }
}
