/**
 * QuizLab - Frontend Quiz Styles
 * Professional blue theme (#2563eb)
 * CSS prefix: .ql-
 *
 * @package     QuizLab
 * @copyright   (C) 2026 The Design Company. All rights reserved.
 */

/* ================================================
   Variables
   ================================================ */
:root {
    --ql-primary: #2563eb;
    --ql-primary-dark: #1d4ed8;
    --ql-primary-light: #dbeafe;
    --ql-success: #16a34a;
    --ql-success-light: #dcfce7;
    --ql-danger: #dc2626;
    --ql-danger-light: #fee2e2;
    --ql-warning: #f59e0b;
    --ql-text: #1e293b;
    --ql-text-muted: #64748b;
    --ql-bg: #ffffff;
    --ql-bg-light: #f8fafc;
    --ql-border: #e2e8f0;
    --ql-radius: 12px;
    --ql-radius-sm: 8px;
    --ql-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --ql-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --ql-transition: all 0.2s ease;
}

/* ================================================
   Base Layout
   ================================================ */
.ql-quiz {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ql-text);
    line-height: 1.6;
}

.ql-card {
    background: var(--ql-bg);
    border-radius: var(--ql-radius);
    box-shadow: var(--ql-shadow);
    padding: 2rem;
}

.ql-screen {
    animation: ql-fadeIn 0.3s ease;
}

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

/* ================================================
   Typography
   ================================================ */
.ql-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ql-primary);
    margin: 0 0 1rem;
    line-height: 1.3;
}

.ql-intro-text {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.ql-instructions {
    background: var(--ql-bg-light);
    border-left: 4px solid var(--ql-primary);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--ql-radius-sm) var(--ql-radius-sm) 0;
}

/* ================================================
   Meta info
   ================================================ */
.ql-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--ql-text-muted);
    font-size: 0.95rem;
}

.ql-meta-item strong {
    color: var(--ql-text);
}

/* ================================================
   Buttons
   ================================================ */
.ql-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--ql-radius-sm);
    cursor: pointer;
    transition: var(--ql-transition);
    text-decoration: none;
    line-height: 1.4;
}

.ql-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--ql-shadow);
}

.ql-btn:active {
    transform: translateY(0);
}

.ql-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ql-btn-primary {
    background: var(--ql-primary);
    color: #fff;
}

.ql-btn-primary:hover:not(:disabled) {
    background: var(--ql-primary-dark);
    color: #fff;
}

.ql-btn-secondary {
    background: var(--ql-bg-light);
    color: var(--ql-primary);
    border: 2px solid var(--ql-primary);
}

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

.ql-btn-success {
    background: var(--ql-success);
    color: #fff;
}

.ql-btn-success:hover:not(:disabled) {
    background: #15803d;
    color: #fff;
}

.ql-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ================================================
   Progress Bar
   ================================================ */
.ql-progress {
    height: 6px;
    background: var(--ql-border);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.ql-progress-bar {
    height: 100%;
    background: var(--ql-primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ================================================
   Question Header
   ================================================ */
.ql-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ql-question-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ql-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ql-question-counter {
    font-size: 0.85rem;
    color: var(--ql-text-muted);
}

.ql-question-text {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.ql-question-image {
    margin-bottom: 1.5rem;
    text-align: center;
}

.ql-question-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--ql-radius-sm);
}

/* ================================================
   Answer Options
   ================================================ */
.ql-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.ql-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--ql-bg-light);
    border: 2px solid var(--ql-border);
    border-radius: var(--ql-radius-sm);
    cursor: pointer;
    transition: var(--ql-transition);
    font-size: 1rem;
}

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

.ql-option.ql-option-selected {
    border-color: var(--ql-primary);
    background: var(--ql-primary-light);
}

.ql-option.ql-option-correct {
    border-color: var(--ql-success);
    background: var(--ql-success-light);
}

.ql-option.ql-option-incorrect {
    border-color: var(--ql-danger);
    background: var(--ql-danger-light);
}

.ql-option.ql-option-disabled {
    cursor: default;
    opacity: 0.8;
}

.ql-option-marker {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--ql-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ql-text-muted);
    flex-shrink: 0;
    transition: var(--ql-transition);
}

.ql-option-selected .ql-option-marker {
    border-color: var(--ql-primary);
    background: var(--ql-primary);
    color: #fff;
}

.ql-option-correct .ql-option-marker {
    border-color: var(--ql-success);
    background: var(--ql-success);
    color: #fff;
}

.ql-option-incorrect .ql-option-marker {
    border-color: var(--ql-danger);
    background: var(--ql-danger);
    color: #fff;
}

.ql-option-text {
    flex: 1;
}

.ql-option-image {
    max-width: 120px;
    height: auto;
    border-radius: 4px;
}

/* ================================================
   Numeric Input
   ================================================ */
.ql-numeric-input {
    margin-bottom: 1.5rem;
}

.ql-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--ql-border);
    border-radius: var(--ql-radius-sm);
    background: var(--ql-bg);
    color: var(--ql-text);
    transition: var(--ql-transition);
    box-sizing: border-box;
}

.ql-input:focus {
    outline: none;
    border-color: var(--ql-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ================================================
   Feedback
   ================================================ */
.ql-feedback {
    padding: 1rem 1.25rem;
    border-radius: var(--ql-radius-sm);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
}

.ql-feedback-correct {
    background: var(--ql-success-light);
    color: var(--ql-success);
    border: 1px solid var(--ql-success);
}

.ql-feedback-incorrect {
    background: var(--ql-danger-light);
    color: var(--ql-danger);
    border: 1px solid var(--ql-danger);
}

.ql-explanation {
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border: 1px solid var(--ql-warning);
    border-radius: var(--ql-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: #92400e;
}

/* ================================================
   Actions
   ================================================ */
.ql-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.ql-score-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ql-border);
    font-size: 0.9rem;
    color: var(--ql-text-muted);
}

/* ================================================
   Results Screen
   ================================================ */
.ql-result-icon {
    text-align: center;
    font-size: 4rem;
    margin-bottom: 1rem;
}

.ql-result-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ql-result-percentage {
    text-align: center;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.ql-result-passed .ql-result-title { color: var(--ql-success); }
.ql-result-passed .ql-result-percentage { color: var(--ql-success); }
.ql-result-failed .ql-result-title { color: var(--ql-danger); }
.ql-result-failed .ql-result-percentage { color: var(--ql-danger); }

.ql-result-details {
    text-align: center;
    color: var(--ql-text-muted);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.ql-result-summary {
    margin-top: 1.5rem;
}

.ql-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--ql-radius-sm);
    font-size: 0.95rem;
}

.ql-summary-correct {
    background: var(--ql-success-light);
}

.ql-summary-incorrect {
    background: var(--ql-danger-light);
}

.ql-summary-icon {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ================================================
   Certificate Form
   ================================================ */
.ql-certificate-form {
    background: var(--ql-bg-light);
    border: 1px solid var(--ql-border);
    border-radius: var(--ql-radius-sm);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.ql-certificate-form h3 {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    color: var(--ql-primary);
}

.ql-form-group {
    margin-bottom: 1rem;
}

.ql-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.ql-certificate-download {
    text-align: center;
    margin: 1.5rem 0;
}

/* ================================================
   Loading / Spinner
   ================================================ */
.ql-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ql-spin 0.6s linear infinite;
}

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

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 640px) {
    .ql-card {
        padding: 1.25rem;
    }

    .ql-title {
        font-size: 1.35rem;
    }

    .ql-question-text {
        font-size: 1.05rem;
    }

    .ql-result-percentage {
        font-size: 2.5rem;
    }

    .ql-actions {
        flex-direction: column;
    }

    .ql-btn-lg {
        width: 100%;
    }

    .ql-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}
