/**
 * WEM Assessment Frontend Styles
 */

/* Modal Overlay */
.wem-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.wem-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    height: 70vh;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.wem-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.wem-modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #333;
}

.wem-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Ensure navigation stays at bottom */
.wem-modal-body > div:last-child {
    margin-bottom: 20px;
}

.wem-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.wem-modal-close:hover {
    background: #e0e0e0;
}

.wem-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Assessment Content */
.wem-assessment-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

.wem-screen {
    display: none;
}

.wem-screen.active {
    display: block;
}

/* Intro Screen */
.wem-intro-content {
    padding: 40px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.wem-intro-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2em;
}

.wem-intro-content p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

.wem-email-section {
    margin: 30px 0;
    text-align: left;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.wem-email-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.wem-email-section input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.wem-email-note {
    margin: 8px 0 0 0;
    font-size: 0.9em;
    color: #666;
}

.wem-intro-actions {
    margin-top: 30px;
}

/* Buttons */
.wem-btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 0 8px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-width: 120px;
    pointer-events: auto;
    z-index: 9999;
    position: relative;
}

.wem-btn-primary {
    background: #3b82f6;
    color: white;
}

.wem-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.wem-btn-secondary {
    background: #6b7280;
    color: white;
}

.wem-btn-secondary:hover {
    background: #4b5563;
}

.wem-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Assessment Screen */
.wem-assessment-header {
    background: #f8f9fa;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.wem-progress-section {
    flex: 1;
    min-width: 200px;
}

.wem-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.wem-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.wem-progress-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.wem-timer-section {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.wem-timer {
    font-family: monospace;
    font-weight: 600;
    color: #333;
}

.wem-assessment-body {
    padding: 40px;
    min-height: 400px;
}

.wem-question-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Question Types */
.wem-question {
    margin-bottom: 30px;
}

.wem-question-header {
    margin-bottom: 20px;
}

.wem-question-number {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.wem-question-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.wem-question-type {
    font-size: 12px;
    color: #3b82f6;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Slider Questions */
.wem-slider-question {
    text-align: center;
    margin-bottom: 5px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
}

.wem-sliders-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Mobile-friendly adjustments */
@media (max-width: 768px) {
    .wem-slider-question {
        margin-bottom: 3px;
        padding: 6px;
    }
    
    .wem-sliders-container {
        gap: 2px;
    }
    
    .wem-slider-labels {
        flex-direction: column;
        gap: 2px;
        margin-bottom: 8px;
    }
    
    .wem-slider-label {
        font-size: 11px;
        line-height: 1.1;
    }
    
    .wem-slider-container {
        margin: 6px 0;
    }
    
    .wem-slider {
        width: 100%;
        margin: 2px 0;
    }
    
    .wem-dimension-header h2 {
        font-size: 14px;
        margin-bottom: 2px;
    }
    
    .wem-dimension-header p {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .wem-progress-text {
        font-size: 11px;
    }
    
    .wem-assessment-header {
        padding: 8px;
    }
    
    .wem-assessment-body {
        padding: 8px;
    }
    
    .wem-navigation {
        padding: 8px;
    }
}

.wem-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.wem-slider-label {
    max-width: 45%;
    text-align: center;
    line-height: 1.4;
}

.wem-slider-container {
    margin: 20px 0;
}

.wem-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.wem-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wem-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wem-slider-value {
    text-align: center;
    margin-top: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #3b82f6;
}

/* Ability Questions */
.wem-ability-question {
    text-align: left;
}

.wem-ability-question-text {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
    border-left: 4px solid #3b82f6;
}

.wem-ability-options {
    display: grid;
    gap: 12px;
}

.wem-ability-option {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.wem-ability-option:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
}

.wem-ability-option.selected {
    border-color: #3b82f6;
    background: #e0f2fe;
}

.wem-ability-option input[type="radio"] {
    margin-right: 12px;
    margin-top: 2px;
}

.wem-ability-option-label {
    flex: 1;
    font-size: 15px;
    line-height: 1.5;
}

/* Assessment Footer */
.wem-assessment-footer {
    padding: 20px 40px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Results Screen */
.wem-results-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.wem-results-header h2 {
    margin: 0;
    font-size: 2.5em;
    font-weight: 300;
}

.wem-results-tabs {
    display: flex;
    justify-content: center;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.wem-tab-btn {
    padding: 16px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.wem-tab-btn:hover {
    color: #333;
    background: #e9ecef;
}

.wem-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: white;
}

.wem-results-content {
    padding: 40px;
}

.wem-tab-content {
    display: none;
}

.wem-tab-content.active {
    display: block;
}

/* Chart Container */
.wem-chart-container {
    text-align: center;
    margin-bottom: 40px;
}

.wem-chart-container canvas {
    max-width: 100%;
    height: auto;
}

/* Scores Display */
.wem-scores-list h3 {
    margin-bottom: 20px;
    color: #333;
}

.wem-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.wem-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.wem-score-label {
    font-weight: 600;
    color: #333;
}

.wem-score-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
}

/* Map Container */
.wem-map-container {
    text-align: center;
}

.wem-map-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Answers Table */
.wem-answers-container h3 {
    margin-bottom: 20px;
    color: #333;
}

.wem-answers-table {
    overflow-x: auto;
    margin-bottom: 30px;
}

.wem-answers-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wem-answers-table th,
.wem-answers-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.wem-answers-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wem-answers-table tr:hover {
    background: #f8f9fa;
}

/* JSON Section */
.wem-json-section {
    margin-top: 30px;
}

.wem-json-section h4 {
    margin-bottom: 12px;
    color: #333;
}

.wem-json-section textarea {
    width: 100%;
    height: 200px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    background: #f8f9fa;
    resize: vertical;
    box-sizing: border-box;
}

/* Results Actions */
.wem-results-actions {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* Loading States */
.wem-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.wem-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: wem-spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes wem-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.wem-error {
    background: #fee;
    color: #c33;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #c33;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wem-modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .wem-assessment-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .wem-progress-section {
        min-width: auto;
    }
    
    .wem-assessment-body,
    .wem-results-content {
        padding: 20px;
    }
    
    .wem-scores-grid {
        grid-template-columns: 1fr;
    }
    
    .wem-map-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .wem-btn {
        margin: 4px;
        min-width: 100px;
    }
}

/* Accessibility */
.wem-screen:focus {
    outline: none;
}

.wem-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.wem-ability-option:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Answer Selection Feedback */
.wem-radio:checked + span {
    font-weight: 600;
}

.wem-radio:checked {
    accent-color: #28a745;
}

/* Auto-advance visual feedback */
.wem-ability-option {
    transition: all 0.3s ease;
}

.wem-ability-option:hover {
    background-color: #f8f9fa;
    border-color: #007cba;
}

.wem-ability-option.selected {
    background-color: #e8f5e8;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

/* Print Styles */
@media print {
    .wem-modal-overlay {
        position: static;
        background: none;
    }
    
    .wem-modal-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .wem-modal-header,
    .wem-assessment-footer,
    .wem-results-actions {
        display: none;
    }
}
