/* Trader Level Quiz - Frontend Styles (v1.2) */
/* Brand Color: #00565C */

/* ===== Modal ===== */
.trader-quiz-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.trader-quiz-modal.is-open {
    display: flex;
    animation: tqFadeIn 0.2s ease-out;
}

.trader-quiz-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
}

.trader-quiz-modal-content {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: tqSlideUp 0.3s ease-out;
}

.trader-quiz-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.trader-quiz-modal-close:hover {
    background: #e5e7eb;
}

@keyframes tqFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ===== Container ===== */
.trader-quiz-container {
    padding: 32px 28px;
    direction: rtl;
    text-align: right;
    color: #1f2937;
}

.trader-quiz-shortcode-hint {
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* ===== Steps ===== */
.quiz-step {
    animation: tqFadeIn 0.3s ease-out;
}

.quiz-step-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px;
    text-align: center;
}

.quiz-step-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
    text-align: center;
    line-height: 1.7;
}

/* ===== Phone input ===== */
.phone-input-wrap {
    margin-bottom: 16px;
}

.quiz-phone-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    text-align: center;
    letter-spacing: 2px;
    direction: ltr;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}

.quiz-phone-input:focus {
    outline: none;
    border-color: #00565C;
    background: #fff;
}

.quiz-phone-input.has-error {
    border-color: #ef4444;
}

.phone-error {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
    margin-bottom: 12px;
}

/* ===== Buttons ===== */
.quiz-btn-primary,
.quiz-btn-secondary {
    display: inline-block;
    border: none;
    padding: 13px 28px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.2;
}

.quiz-btn-primary {
    background: linear-gradient(135deg, #00565C 0%, #007a82 100%);
    color: #fff;
    width: 100%;
    box-shadow: 0 4px 14px rgba(0, 86, 92, 0.3);
}

.quiz-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 86, 92, 0.4);
}

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

.quiz-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.quiz-btn-secondary:hover {
    background: #e5e7eb;
}

/* ===== Intro ===== */
.quiz-step-intro {
    text-align: center;
    padding: 10px 0;
}

.quiz-step-intro .intro-text {
    font-size: 16px;
    line-height: 1.9;
    color: #374151;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 86, 92, 0.08) 0%, rgba(0, 86, 92, 0.03) 100%);
    border-radius: 12px;
    border-right: 4px solid #00565C;
}

/* ===== Progress ===== */
.quiz-progress {
    background: #e5e7eb;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    background: linear-gradient(90deg, #00565C, #007a82);
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.question-counter {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 18px;
    text-align: left;
    direction: ltr;
    display: inline-block;
}

/* ===== Question ===== */
.question-content {
    min-height: 180px;
}

.question-text {
    font-size: 17px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 20px;
    line-height: 1.7;
}

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

.option-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    padding: 14px 16px;
    text-align: right;
    font-size: 14px;
    color: #374151;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    line-height: 1.5;
}

.option-btn:hover {
    border-color: #00565C;
    background: rgba(0, 86, 92, 0.08);
    transform: translateX(-2px);
}

.option-btn.selected {
    border-color: #00565C;
    background: rgba(0, 86, 92, 0.12);
    color: #003a40;
    font-weight: 600;
}

/* ===== Navigation ===== */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    gap: 12px;
}

.quiz-navigation .quiz-btn {
    padding: 11px 24px;
    font-size: 14px;
    width: auto;
}

.quiz-navigation .quiz-btn-primary {
    margin-right: auto;
}

/* ===== Result ===== */
.quiz-step-result {
    text-align: center;
    padding: 10px 0;
}

.result-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.result-level {
    font-size: 22px;
    font-weight: 700;
    color: #003a40;
    margin: 0 0 16px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(0, 86, 92, 0.08) 0%, rgba(0, 86, 92, 0.03) 100%);
    border-radius: 12px;
    border: 2px solid rgba(0, 86, 92, 0.3);
}

.result-description {
    font-size: 15px;
    line-height: 1.8;
    color: #4b5563;
    margin-bottom: 16px;
    white-space: pre-wrap;
    padding: 0 10px;
	text-align: center;
}

/* ===== Loading ===== */
.quiz-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #00565C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.quiz-loading p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .trader-quiz-modal {
        padding: 0;
        align-items: stretch;
    }
    
    .trader-quiz-modal-content {
        max-height: 100vh;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .trader-quiz-container {
        padding: 24px 18px;
    }
    
    .quiz-step-title {
        font-size: 19px;
    }
    
    .question-text {
        font-size: 15px;
    }
    
    .option-btn {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .result-level {
        font-size: 18px;
        padding: 14px;
    }
    
    .quiz-btn-primary,
    .quiz-btn-secondary {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .quiz-step-intro .intro-text {
        font-size: 14px;
        padding: 14px;
    }
    
    .quiz-phone-input {
        font-size: 15px;
        padding: 12px 14px;
    }
}

@media (max-width: 380px) {
    .trader-quiz-container {
        padding: 20px 14px;
    }
    
    .quiz-navigation .quiz-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Print-friendly */
@media print {
    .trader-quiz-modal {
        position: static;
        display: block;
    }
    
    .trader-quiz-modal-backdrop,
    .trader-quiz-modal-close {
        display: none;
    }
}
