/**
 * PNMA Quest Event - Quiz Styles
 * Airbnb-inspired Minimal Design
 * Version: 1.0.0
 */

/* CSS Variables - Blue Professional Theme */
:root {
    --pnma-primary: #2563EB;
    --pnma-primary-hover: #1D4ED8;
    --pnma-primary-light: #DBEAFE;
    --pnma-primary-dark: #1E3A8A;
    --pnma-success: #10B981;
    --pnma-success-light: #D1FAE5;
    --pnma-warning: #F59E0B;
    --pnma-error: #EF4444;
    --pnma-error-light: #FEE2E2;
    --pnma-dark: #111827;
    --pnma-gray-900: #1F2937;
    --pnma-gray-700: #374151;
    --pnma-gray-500: #6B7280;
    --pnma-gray-400: #9CA3AF;
    --pnma-gray-300: #D1D5DB;
    --pnma-gray-200: #E5E7EB;
    --pnma-gray-100: #F3F4F6;
    --pnma-gray-50: #F9FAFB;
    --pnma-white: #FFFFFF;
    --pnma-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
    --pnma-radius-sm: 8px;
    --pnma-radius-md: 12px;
    --pnma-radius-lg: 16px;
    --pnma-radius-xl: 24px;
    --pnma-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --pnma-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --pnma-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --pnma-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --pnma-transition-fast: 150ms ease;
    --pnma-transition: 200ms ease;
    --pnma-transition-slow: 300ms ease;
}

/* Reset & Base */
.pnma-qe-wrapper,
.pnma-qe-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Wrapper */
.pnma-qe-wrapper {
    font-family: var(--pnma-font);
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 12px;
}

/* Card Container */
.pnma-qe-card {
    background: var(--pnma-white);
    border-radius: var(--pnma-radius-xl);
    box-shadow: var(--pnma-shadow-lg);
    overflow: hidden;
}

/* Header */
.pnma-qe-header {
    background: linear-gradient(135deg, var(--pnma-primary) 0%, var(--pnma-primary-dark) 100%);
    color: var(--pnma-white);
    padding: 20px 20px;
    text-align: center;
}

.pnma-qe-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.pnma-qe-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

/* Form */
.pnma-qe-form {
    padding: 20px 20px;
}

/* Section */
.pnma-qe-section {
    margin-bottom: 20px;
}

.pnma-qe-section:last-child {
    margin-bottom: 0;
}

.pnma-qe-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--pnma-gray-700);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pnma-qe-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--pnma-primary);
    border-radius: 2px;
}

/* Form Grid */
.pnma-qe-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 480px) {
    .pnma-qe-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Form Group */
.pnma-qe-form-group {
    display: flex;
    flex-direction: column;
}

/* Label */
.pnma-qe-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--pnma-gray-700);
    margin-bottom: 6px;
}

.pnma-qe-required {
    color: var(--pnma-error);
    margin-left: 2px;
}

/* Input */
.pnma-qe-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--pnma-dark);
    background: var(--pnma-white);
    border: 2px solid var(--pnma-gray-200);
    border-radius: var(--pnma-radius-md);
    outline: none;
    transition: var(--pnma-transition);
}

.pnma-qe-input::placeholder {
    color: var(--pnma-gray-400);
}

.pnma-qe-input:hover {
    border-color: var(--pnma-gray-300);
}

.pnma-qe-input:focus {
    border-color: var(--pnma-primary);
    box-shadow: 0 0 0 3px var(--pnma-primary-light);
}

.pnma-qe-input.error {
    border-color: var(--pnma-error);
}

.pnma-qe-input.error:focus {
    box-shadow: 0 0 0 3px var(--pnma-error-light);
}

/* Error Text */
.pnma-qe-error-text {
    font-size: 12px;
    color: var(--pnma-error);
    margin-top: 6px;
    display: none;
}

.pnma-qe-error-text.show {
    display: block;
}

/* Question Box */
.pnma-qe-question-box {
    background: var(--pnma-gray-50);
    border-left: 4px solid var(--pnma-primary);
    padding: 14px;
    border-radius: 0 var(--pnma-radius-md) var(--pnma-radius-md) 0;
    margin-bottom: 16px;
}

.pnma-qe-question-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--pnma-gray-700);
    margin: 0;
}

/* Choices */
.pnma-qe-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Choice Card */
.pnma-qe-choice-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: var(--pnma-white);
    border: 2px solid var(--pnma-gray-200);
    border-radius: var(--pnma-radius-md);
    cursor: pointer;
    transition: var(--pnma-transition);
    position: relative;
}

.pnma-qe-choice-card:hover {
    border-color: var(--pnma-gray-300);
    background: var(--pnma-gray-50);
}

.pnma-qe-choice-card.selected {
    border-color: var(--pnma-primary);
    background: var(--pnma-primary-light);
}

/* Hidden radio input */
.pnma-qe-radio-input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

/* Choice Indicator */
.pnma-qe-choice-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--pnma-gray-100);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: var(--pnma-gray-500);
    transition: var(--pnma-transition);
}

.pnma-qe-choice-card.selected .pnma-qe-choice-indicator {
    background: var(--pnma-primary);
    color: var(--pnma-white);
}

/* Choice Text */
.pnma-qe-choice-text {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
    color: var(--pnma-gray-700);
    padding-top: 4px;
}

/* Choice Check */
.pnma-qe-choice-check {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0;
    color: var(--pnma-primary);
    transition: var(--pnma-transition);
}

.pnma-qe-choice-check svg {
    width: 20px;
    height: 20px;
}

.pnma-qe-choice-card.selected .pnma-qe-choice-check {
    opacity: 1;
}

/* Submit Section */
.pnma-qe-submit-section {
    margin-top: 20px;
}

/* Submit Button */
.pnma-qe-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--pnma-white);
    background: linear-gradient(135deg, var(--pnma-primary) 0%, var(--pnma-primary-hover) 100%);
    border: none;
    border-radius: var(--pnma-radius-md);
    cursor: pointer;
    transition: var(--pnma-transition);
    position: relative;
    overflow: hidden;
}

.pnma-qe-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--pnma-shadow-lg);
}

.pnma-qe-submit-btn:active {
    transform: translateY(0);
}

.pnma-qe-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.pnma-qe-submit-btn.loading .pnma-qe-btn-text {
    opacity: 0;
}

.pnma-qe-submit-btn.loading .pnma-qe-btn-loader {
    opacity: 1;
}

/* Button Loader */
.pnma-qe-btn-loader {
    position: absolute;
    opacity: 0;
    transition: var(--pnma-transition);
}

.pnma-qe-spinner {
    width: 24px;
    height: 24px;
    animation: pnma-spin 1s linear infinite;
}

@keyframes pnma-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== Modal ========== */
.pnma-qe-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: var(--pnma-transition-slow);
}

.pnma-qe-modal.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Backdrop */
.pnma-qe-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Modal Container */
.pnma-qe-modal-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    transform: scale(0.9) translateY(20px);
    transition: var(--pnma-transition-slow);
}

.pnma-qe-modal.show .pnma-qe-modal-container {
    transform: scale(1) translateY(0);
}

/* Modal Content */
.pnma-qe-modal-content {
    background: var(--pnma-white);
    border-radius: var(--pnma-radius-xl);
    padding: 40px 32px 32px;
    text-align: center;
    box-shadow: var(--pnma-shadow-xl);
}

/* Modal Close */
.pnma-qe-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pnma-gray-100);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--pnma-transition);
    color: var(--pnma-gray-500);
}

.pnma-qe-modal-close:hover {
    background: var(--pnma-gray-200);
    color: var(--pnma-gray-700);
}

.pnma-qe-modal-close svg {
    width: 16px;
    height: 16px;
}

/* Modal Icon */
.pnma-qe-modal-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.pnma-qe-modal-icon.success {
    background: var(--pnma-success-light);
    color: var(--pnma-success);
}

.pnma-qe-modal-icon.error {
    background: var(--pnma-error-light);
    color: var(--pnma-error);
}

.pnma-qe-modal-icon.warning {
    background: #FEF3C7;
    color: var(--pnma-warning);
}

/* Modal Title */
.pnma-qe-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--pnma-dark);
    margin: 0 0 12px 0;
}

/* Modal Message */
.pnma-qe-modal-message {
    font-size: 15px;
    line-height: 1.6;
    color: var(--pnma-gray-500);
    margin: 0 0 24px 0;
}

/* Modal Answer Section */
.pnma-qe-modal-answer {
    background: var(--pnma-gray-50);
    border-radius: var(--pnma-radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.pnma-qe-correct-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--pnma-gray-500);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pnma-qe-correct-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--pnma-success);
    margin: 0;
}

/* Modal Button */
.pnma-qe-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--pnma-white);
    background: var(--pnma-primary);
    border: none;
    border-radius: var(--pnma-radius-md);
    cursor: pointer;
    transition: var(--pnma-transition);
}

.pnma-qe-modal-btn:hover {
    background: var(--pnma-primary-hover);
}

/* Responsive */
@media (max-width: 480px) {
    .pnma-qe-wrapper {
        padding: 12px 10px;
    }

    .pnma-qe-header {
        padding: 16px 16px;
    }

    .pnma-qe-title {
        font-size: 18px;
    }

    .pnma-qe-form {
        padding: 16px 16px;
    }

    .pnma-qe-choice-card {
        padding: 10px 14px;
    }

    .pnma-qe-modal-content {
        padding: 24px 20px 20px;
    }
}
