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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 600px;
    margin: 40px auto;
}

.card h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.card h2 {
    color: #333;
    margin-bottom: 15px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

.form-group .optional {
    font-weight: normal;
    color: #999;
    font-size: 0.9em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: border 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-success {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(17, 153, 142, 0.4);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.85em;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    margin: 2px;
}

.btn-edit { background: #ffc107; color: #333; }
.btn-delete { background: #f44336; color: white; }
.btn-manage { background: #2196F3; color: white; }
.btn-export { background: #4CAF50; color: white; }

.btn-back {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-back:hover {
    background: #667eea;
    color: white;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.admin-link {
    text-align: center;
    margin-top: 20px;
}

.admin-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* ===== PACKAGE GRID ===== */
.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.package-card {
    background: linear-gradient(135deg, #f5f7fa, #e8ecf3);
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.package-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.package-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.package-card h3 {
    color: #333;
    margin-bottom: 10px;
}

.package-card p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
    min-height: 40px;
}

.package-card .btn {
    width: auto;
    padding: 10px 20px;
}

/* ===== QUIZ ===== */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.quiz-progress {
    text-align: right;
}

#question-counter {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

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

.question-text {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.5;
    color: #333;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.option:hover {
    border-color: #667eea;
    background: #f5f7ff;
}

.option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f3ff, #e8ecff);
}

.option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.3);
}

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    line-height: 1.4;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

.quiz-actions .btn {
    flex: 1;
}

/* ===== RESULT ===== */
.result-card {
    text-align: center;
}

.result-icon {
    font-size: 5em;
    margin-bottom: 20px;
}

.score-display {
    margin: 30px 0;
}

.score-circle {
    display: inline-block;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.score-circle span {
    font-size: 3em;
    font-weight: bold;
}

.score-circle small {
    font-size: 1em;
    opacity: 0.9;
}

.score-details {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 30px 0;
}

.score-item {
    text-align: center;
}

.score-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.score-value {
    font-size: 2em;
    font-weight: bold;
}

.score-value.correct { color: #4CAF50; }
.score-value.wrong { color: #f44336; }

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.result-actions .btn {
    width: auto;
}

/* ===== RANKING ===== */
.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.ranking-table th,
.ranking-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

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

.ranking-table tr:nth-child(even) {
    background: #f9f9f9;
}

/* ===== DASHBOARD ===== */
.dashboard {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.dashboard-header .btn-secondary {
    width: auto;
}

.dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.tab-header .btn {
    width: auto;
}

.tab-header select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
}

.results-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.results-actions .btn {
    width: auto;
}

/* ===== DATA TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    overflow-x: auto;
    display: block;
}

.data-table thead {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background: #f5f7fa;
    font-weight: 600;
    color: #444;
}

.data-table tr:hover {
    background: #f9f9f9;
}

.data-table .question-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table tr.top-rank {
    background: linear-gradient(90deg, #fff9e6, #fff);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge.active {
    background: #4CAF50;
    color: white;
}

.badge.inactive {
    background: #9e9e9e;
    color: white;
}

.badge.correct {
    background: #4CAF50;
    color: white;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

.modal {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.modal-footer .btn {
    width: auto;
}

/* ===== MANAGE QUESTIONS ===== */
.manage-questions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.manage-col h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.question-manage-list {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
}

.manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}

.manage-item span {
    flex: 1;
    font-size: 0.9em;
    color: #555;
}

.success {
    color: #4CAF50;
    font-weight: 600;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 8px;
    margin: 10px 0;
}

.error {
    color: #f44336;
    font-weight: 600;
    padding: 10px;
    background: #ffebee;
    border-radius: 8px;
    margin: 10px 0;
}

details {
    margin-top: 20px;
    padding: 15px;
    background: #f5f7fa;
    border-radius: 10px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: #667eea;
}

details pre {
    margin-top: 10px;
    padding: 15px;
    background: #2d2d2d;
    color: #f8f8f2;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .card {
        padding: 25px;
        margin: 20px auto;
    }
    
    .card h1 {
        font-size: 2em;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .manage-questions {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .tab-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .score-details {
        gap: 20px;
    }
    
    .result-actions {
        flex-direction: column;
    }
}

/* Quiz Info Banner */
.quiz-info-banner {
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    border-left: 4px solid #ffc107;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.9em;
    color: #856404;
}

/* Package Info */
.package-info {
    margin: 10px 0;
}

.info-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Badge info */
.badge.info {
    background: #2196F3;
    color: white;
}

/* Form hint */
.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}