/**
 * Public Styles for Advanced Quiz Builder
 */

:root {
    --aqb-primary-color: #2271b1;
    --aqb-success-color: #00a32a;
    --aqb-danger-color: #d63638;
    --aqb-warning-color: #dba617;
    --aqb-info-color: #72aee6;
    --aqb-text-color: #1d2327;
    --aqb-text-muted: #646970;
    --aqb-border-color: #dcdcde;
    --aqb-bg-light: #f6f7f7;
    --aqb-bg-white: #ffffff;
    --aqb-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --aqb-shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.15);
    --aqb-radius: 8px;
    --aqb-transition: all 0.3s ease;
}

/* Container */
.aqb-quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: var(--aqb-text-color);
}

/* Quiz Header */
.aqb-quiz-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--aqb-border-color);
}

.aqb-quiz-title {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--aqb-text-color);
    font-weight: 600;
}

.aqb-quiz-description {
    font-size: 16px;
    color: var(--aqb-text-muted);
    margin-bottom: 20px;
    line-height: 1.8;
}

.aqb-quiz-meta {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.aqb-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--aqb-text-muted);
}

.aqb-meta-item .dashicons {
    color: var(--aqb-primary-color);
    font-size: 18px;
}

/* Start Screen */
.aqb-quiz-start {
    background: var(--aqb-bg-white);
    border-radius: var(--aqb-radius);
    box-shadow: var(--aqb-shadow);
    padding: 40px;
    text-align: center;
}

.aqb-start-content h2 {
    font-size: 24px;
    margin-bottom: 30px;
    color: var(--aqb-text-color);
}

.aqb-email-field {
    max-width: 400px;
    margin: 0 auto 30px;
    text-align: left;
}

.aqb-email-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--aqb-text-color);
}

.aqb-email-field .required {
    color: var(--aqb-danger-color);
}

.aqb-email-field input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--aqb-border-color);
    border-radius: 4px;
    font-size: 16px;
    transition: var(--aqb-transition);
}

.aqb-email-field input:focus {
    outline: none;
    border-color: var(--aqb-primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.aqb-quiz-instructions {
    background: var(--aqb-bg-light);
    border-radius: var(--aqb-radius);
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.aqb-quiz-instructions h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--aqb-text-color);
}

.aqb-quiz-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.aqb-quiz-instructions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.aqb-quiz-instructions li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--aqb-success-color);
    font-weight: bold;
}

/* Buttons */
.aqb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--aqb-transition);
    text-decoration: none;
}

.aqb-btn-primary {
    background: var(--aqb-primary-color);
    color: white;
}

.aqb-btn-primary:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: var(--aqb-shadow-hover);
}

.aqb-btn-secondary {
    background: var(--aqb-bg-light);
    color: var(--aqb-text-color);
}

.aqb-btn-secondary:hover {
    background: #e5e7e9;
}

.aqb-btn-success {
    background: var(--aqb-success-color);
    color: white;
}

.aqb-btn-success:hover {
    background: #008a20;
}

.aqb-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Progress Indicators */
.aqb-progress-container {
    margin-bottom: 30px;
}

/* Progress Bar Style */
.aqb-progress-bar {
    height: 30px;
    background: var(--aqb-bg-light);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.aqb-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--aqb-primary-color), #72aee6);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aqb-progress-text {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

/* Progress Steps Style */
.aqb-progress-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.aqb-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.aqb-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--aqb-bg-light);
    border: 2px solid var(--aqb-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--aqb-transition);
}

.aqb-step.active .aqb-step-number {
    background: var(--aqb-primary-color);
    color: white;
    border-color: var(--aqb-primary-color);
}

.aqb-step.completed .aqb-step-number {
    background: var(--aqb-success-color);
    color: white;
    border-color: var(--aqb-success-color);
}

.aqb-step-label {
    font-size: 12px;
    color: var(--aqb-text-muted);
    margin-top: 5px;
    display: none;
}

.aqb-step-connector {
    flex: 1;
    height: 2px;
    background: var(--aqb-border-color);
    position: relative;
    top: -20px;
}

/* Progress Percent Style */
.aqb-progress-percent {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aqb-percent-circle {
    position: relative;
}

.aqb-progress-ring {
    transform: rotate(-90deg);
}

.aqb-progress-ring-fill {
    transition: stroke-dashoffset 0.5s ease;
}

.aqb-percent-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 600;
    color: var(--aqb-primary-color);
}

.aqb-progress-label {
    margin-top: 10px;
    color: var(--aqb-text-muted);
    font-size: 14px;
}

/* Questions */
.aqb-questions-container {
    margin-bottom: 30px;
}

.aqb-question {
    background: var(--aqb-bg-white);
    border-radius: var(--aqb-radius);
    padding: 30px;
    box-shadow: var(--aqb-shadow);
    margin-bottom: 20px;
}

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

.aqb-question-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--aqb-primary-color);
    text-transform: uppercase;
}

.aqb-required-badge {
    background: var(--aqb-danger-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.aqb-question-text {
    font-size: 18px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.aqb-question-instructions {
    background: var(--aqb-bg-light);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--aqb-text-muted);
}

/* Answer Options */
.aqb-answer-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aqb-answer-option {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--aqb-bg-light);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--aqb-transition);
    position: relative;
}

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

.aqb-answer-option input[type="radio"],
.aqb-answer-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
}

.aqb-answer-option input:checked ~ .aqb-answer-label {
    font-weight: 500;
}

.aqb-answer-option input:checked + .aqb-answer-label + .aqb-radio-indicator,
.aqb-answer-option input:checked + .aqb-answer-label + .aqb-checkbox-indicator {
    background: var(--aqb-primary-color);
    border-color: var(--aqb-primary-color);
}

.aqb-radio-indicator,
.aqb-checkbox-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--aqb-border-color);
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--aqb-transition);
}

.aqb-radio-indicator {
    border-radius: 50%;
}

.aqb-checkbox-indicator {
    border-radius: 4px;
}

.aqb-radio-indicator::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    opacity: 0;
}

.aqb-answer-option input:checked + .aqb-answer-label + .aqb-radio-indicator::after {
    opacity: 1;
}

.aqb-checkbox-indicator::after {
    content: "✓";
    color: white;
    font-weight: bold;
    font-size: 12px;
    opacity: 0;
}

.aqb-answer-option input:checked + .aqb-answer-label + .aqb-checkbox-indicator::after {
    opacity: 1;
}

.aqb-answer-label {
    flex-grow: 1;
    margin-left: 32px;
}

/* Text Inputs */
.aqb-text-input,
.aqb-textarea-input,
.aqb-select-input,
.aqb-number-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--aqb-border-color);
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--aqb-transition);
}

.aqb-text-input:focus,
.aqb-textarea-input:focus,
.aqb-select-input:focus,
.aqb-number-input:focus {
    outline: none;
    border-color: var(--aqb-primary-color);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.aqb-textarea-input {
    resize: vertical;
    min-height: 100px;
}

/* Slider Input */
.aqb-slider-container {
    padding: 20px 0;
}

.aqb-slider-input {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--aqb-bg-light);
    outline: none;
}

.aqb-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--aqb-primary-color);
    cursor: pointer;
    box-shadow: var(--aqb-shadow);
}

.aqb-slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--aqb-primary-color);
    cursor: pointer;
    box-shadow: var(--aqb-shadow);
}

.aqb-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 14px;
    color: var(--aqb-text-muted);
}

.aqb-slider-value {
    font-weight: 600;
    color: var(--aqb-primary-color);
}

/* Navigation */
.aqb-quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.aqb-quiz-navigation .aqb-btn {
    flex: 1;
    justify-content: center;
}

/* Validation */
.aqb-field-error {
    color: var(--aqb-danger-color);
    font-size: 14px;
    margin-top: 5px;
}

.aqb-question.has-error .aqb-question-text {
    color: var(--aqb-danger-color);
}

.aqb-question.has-error .aqb-answer-container {
    border: 1px solid var(--aqb-danger-color);
    border-radius: 4px;
    padding: 10px;
}

/* Results */
.aqb-results {
    background: var(--aqb-bg-white);
    border-radius: var(--aqb-radius);
    padding: 40px;
    box-shadow: var(--aqb-shadow);
    text-align: center;
}

.aqb-results-header {
    margin-bottom: 30px;
}

.aqb-success-icon,
.aqb-fail-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aqb-success-icon {
    background: var(--aqb-success-color);
}

.aqb-fail-icon {
    background: var(--aqb-danger-color);
}

.aqb-success-icon .dashicons,
.aqb-fail-icon .dashicons {
    font-size: 40px;
    color: white;
    line-height: 1;
    display: block;
    text-align: center;
}

.aqb-results-header h2 {
    font-size: 28px;
    margin: 0;
}

.aqb-passed .aqb-results-header h2 {
    color: var(--aqb-success-color);
}

.aqb-failed .aqb-results-header h2 {
    color: var(--aqb-danger-color);
}

/* Score Display */
.aqb-score-display {
    margin: 30px 0;
}

.aqb-score-circle {
    position: relative;
    display: inline-block;
}

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

.aqb-score-percent {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--aqb-text-color);
}

.aqb-score-fraction {
    display: block;
    font-size: 16px;
    color: var(--aqb-text-muted);
    margin-top: 5px;
}

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

.aqb-stat {
    display: flex;
    flex-direction: column;
}

.aqb-stat-label {
    font-size: 14px;
    color: var(--aqb-text-muted);
    margin-bottom: 5px;
}

.aqb-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--aqb-text-color);
}

/* Detailed Results */
.aqb-detailed-results {
    margin-top: 40px;
    text-align: left;
}

.aqb-detailed-results h3 {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.aqb-result-item {
    background: var(--aqb-bg-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid var(--aqb-border-color);
}

.aqb-result-item.correct {
    border-left-color: var(--aqb-success-color);
}

.aqb-result-item.incorrect {
    border-left-color: var(--aqb-danger-color);
}

.aqb-result-question {
    font-weight: 500;
    margin-bottom: 15px;
}

.aqb-user-answer,
.aqb-correct-answer {
    margin-bottom: 10px;
}

.aqb-answer-label {
    font-weight: 600;
    color: var(--aqb-text-muted);
    margin-right: 10px;
}

.aqb-result-points {
    margin-top: 10px;
    padding: 5px 10px;
    background: var(--aqb-bg-white);
    border-radius: 4px;
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
}

.aqb-result-explanation {
    margin-top: 15px;
    padding: 15px;
    background: #fff8dc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

/* Results Actions */
.aqb-results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Share Modal */
.aqb-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.aqb-share-content {
    background: var(--aqb-bg-white);
    padding: 30px;
    border-radius: var(--aqb-radius);
    max-width: 400px;
    width: 90%;
}

.aqb-share-content h4 {
    margin-bottom: 20px;
    text-align: center;
}

.aqb-share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.aqb-share-buttons a,
.aqb-share-buttons button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--aqb-bg-light);
    color: var(--aqb-text-color);
    transition: var(--aqb-transition);
    border: none;
    cursor: pointer;
}

.aqb-share-buttons a:hover,
.aqb-share-buttons button:hover {
    background: var(--aqb-primary-color);
    color: white;
    transform: translateY(-3px);
}

/* Loading Overlay */
.aqb-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.aqb-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--aqb-bg-light);
    border-top-color: var(--aqb-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.aqb-loading-overlay p {
    margin-top: 20px;
    font-size: 16px;
    color: var(--aqb-text-muted);
}

/* Error Messages */
.aqb-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--aqb-danger-color);
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .aqb-quiz-container {
        padding: 15px;
    }
    
    .aqb-quiz-title {
        font-size: 24px;
    }
    
    .aqb-quiz-start,
    .aqb-question,
    .aqb-results {
        padding: 20px;
    }
    
    .aqb-quiz-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .aqb-score-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .aqb-quiz-navigation {
        flex-direction: column;
    }
    
    .aqb-quiz-navigation .aqb-btn {
        width: 100%;
    }
    
    .aqb-step-label {
        display: none;
    }
    
    .aqb-progress-steps {
        padding: 0 20px;
    }
}

@media screen and (max-width: 480px) {
    .aqb-quiz-title {
        font-size: 20px;
    }
    
    .aqb-question-text {
        font-size: 16px;
    }
    
    .aqb-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .aqb-score-percent {
        font-size: 28px;
    }
}

/* Print Styles */
@media print {
    .aqb-quiz-navigation,
    .aqb-results-actions,
    .aqb-share-modal {
        display: none !important;
    }
    
    .aqb-quiz-container {
        max-width: 100%;
    }
    
    .aqb-question {
        page-break-inside: avoid;
    }
}

/* Accessibility */
.aqb-quiz-container:focus-within {
    outline: 2px solid var(--aqb-primary-color);
    outline-offset: 2px;
}

.aqb-btn:focus,
.aqb-answer-option:focus-within {
    outline: 2px solid var(--aqb-primary-color);
    outline-offset: 2px;
}

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

.aqb-question-step {
    animation: fadeIn 0.5s ease;
}

.aqb-results {
    animation: fadeIn 0.5s ease;
}

/* Custom scrollbar */
.aqb-quiz-container::-webkit-scrollbar {
    width: 8px;
}

.aqb-quiz-container::-webkit-scrollbar-track {
    background: var(--aqb-bg-light);
    border-radius: 4px;
}

.aqb-quiz-container::-webkit-scrollbar-thumb {
    background: var(--aqb-primary-color);
    border-radius: 4px;
}

.aqb-quiz-container::-webkit-scrollbar-thumb:hover {
    background: #135e96;
}


/* ========================================
   Error Messages
   ======================================== */

.aqb-error-message {
    color: #d32f2f;
    margin-top: 8px;
    font-size: 14px;
}

.aqb-field-error {
    display: none;
}

/* ========================================
   Quiz Form Initial States
   ======================================== */

.aqb-quiz-form.hidden {
    display: none;
}

.aqb-prev-step.hidden {
    display: none;
}

.aqb-submit-quiz.hidden {
    display: none;
}

.aqb-results-container.hidden {
    display: none;
}

.aqb-loading-overlay.hidden {
    display: none;
}

/* ========================================
   Progress Bar
   ======================================== */

.aqb-progress-fill {
    width: 0%;
    transition: width 0.3s ease;
}

/* ========================================
   Email Verification
   ======================================== */

.aqb-email-verification {
    background: var(--aqb-bg-white);
    border-radius: var(--aqb-radius);
    padding: 40px;
    box-shadow: var(--aqb-shadow);
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.aqb-email-verification h2 {
    color: var(--aqb-primary-color);
    margin-bottom: 20px;
    font-size: 24px;
}

.aqb-email-verification p {
    margin-bottom: 15px;
    color: var(--aqb-text-color);
    line-height: 1.6;
}

.aqb-verification-form {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.aqb-verification-form input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    border: 2px solid var(--aqb-border-color);
    border-radius: var(--aqb-radius);
    font-weight: 600;
}

.aqb-verification-form input[type="text"]:focus {
    border-color: var(--aqb-primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.aqb-verification-form .aqb-btn {
    min-width: 200px;
}
