/**
 * Frontend CSS for WP Assessment
 */

.wp-assessment-container {
    /* Container styles removed - theme will handle layout */
}

/* Header */
.wp-assessment-header {
    margin-bottom: 2rem;
}

.wp-assessment-title {
    margin: 0 0 1rem;
}

.wp-assessment-description {
    line-height: 1.6;
}

/* Progress */
.wp-assessment-progress {
    margin-bottom: 2rem;
}

.wp-assessment-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.wp-assessment-progress-fill {
    height: 100%;
    background: #0073aa;
    /* No transition - updates instantly to avoid conflicting with step animations */
}

.wp-assessment-progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: #666;
}

/* Steps - Using absolute positioning for smooth opacity transitions */
.wp-assessment-steps {
    position: relative;
    /* Height is set dynamically by JS based on active step */
    overflow: hidden;
    transition: height var(--wp-assessment-duration, 300ms) ease;
}

.wp-assessment-step {
    /* All steps absolutely positioned, invisible by default */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none; /* Prevent interaction with hidden steps */

    /* GPU acceleration for smooth transitions */
    will-change: opacity;
    transform: translateZ(0);

    /* Smooth opacity transition */
    transition: opacity var(--wp-assessment-duration, 300ms) ease;
}

.wp-assessment-step.active {
    /* Active step is visible and interactive */
    opacity: 1;
    pointer-events: auto;
}

.wp-assessment-step-content {
    /* Step content styles removed - theme will handle layout */
}

.wp-assessment-question {
    margin: 0 0 1rem;
}

.wp-assessment-step-description {
    margin: 0 0 2rem;
    line-height: 1.6;
}

/* Fields Container */
.wp-assessment-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.wp-assessment-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wp-assessment-field-label {
    font-weight: 600;
}

.wp-assessment-field-label .required {
    color: #d63638;
    margin-left: 3px;
}

/* Radio Fields */
.wp-assessment-radio-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wp-assessment-radio-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-assessment-radio-label:hover {
    border-color: #0073aa;
    background: #f0f6fc;
}

.wp-assessment-radio-input {
    margin: 0;
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.wp-assessment-radio-input:checked + .wp-assessment-radio-text {
    font-weight: 600;
    color: #0073aa;
}

.wp-assessment-radio-label:has(.wp-assessment-radio-input:checked) {
    border-color: #0073aa;
    background: #f0f6fc;
}

.wp-assessment-radio-text {
    transition: all 0.2s ease;
}

/* Checkbox Fields */
.wp-assessment-checkbox-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wp-assessment-checkbox-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-assessment-checkbox-label:hover {
    border-color: #0073aa;
    background: #f0f6fc;
}

.wp-assessment-checkbox-input {
    margin: 0;
    margin-right: 0.75rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.wp-assessment-checkbox-input:checked + .wp-assessment-checkbox-text {
    font-weight: 600;
    color: #0073aa;
}

.wp-assessment-checkbox-label:has(.wp-assessment-checkbox-input:checked) {
    border-color: #0073aa;
    background: #f0f6fc;
}

.wp-assessment-checkbox-text {
    transition: all 0.2s ease;
}

/* Height & Weight Field */
.wp-assessment-height-weight-field {
    margin-bottom: 1rem;
}

.wp-assessment-height-weight-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wp-assessment-height-fieldset,
.wp-assessment-weight-fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.wp-assessment-fieldset-legend {
    font-size: 1.125rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 1rem;
    padding: 0;
}

.wp-assessment-height-inputs,
.wp-assessment-weight-inputs {
    display: flex;
    gap: 1rem;
}

.wp-assessment-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wp-assessment-input-group-wide {
    flex: 2;
}

.wp-assessment-input-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 0.5rem;
}

.wp-assessment-height-feet-input,
.wp-assessment-height-inches-input,
.wp-assessment-weight-input {
    padding: 1rem;
    font-size: 1.125rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wp-assessment-height-feet-input:focus,
.wp-assessment-height-inches-input:focus,
.wp-assessment-weight-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.wp-assessment-height-feet-input::placeholder,
.wp-assessment-height-inches-input::placeholder,
.wp-assessment-weight-input::placeholder {
    color: #aaa;
}

/* Remove number input spinners for cleaner look */
.wp-assessment-height-feet-input::-webkit-outer-spin-button,
.wp-assessment-height-feet-input::-webkit-inner-spin-button,
.wp-assessment-height-inches-input::-webkit-outer-spin-button,
.wp-assessment-height-inches-input::-webkit-inner-spin-button,
.wp-assessment-weight-input::-webkit-outer-spin-button,
.wp-assessment-weight-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wp-assessment-height-feet-input,
.wp-assessment-height-inches-input,
.wp-assessment-weight-input {
    -moz-appearance: textfield;
}

/* Navigation buttons */
.wp-assessment-navigation {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.wp-assessment-next-btn {
    order: 1; /* Show first (above back button) */
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    background: #0073aa;
}

.wp-assessment-next-btn:hover {
    background: #005a87;
}

.wp-assessment-next-btn:active {
    background: #004a6e;
}

.wp-assessment-back-btn {
    order: 2; /* Show second (below continue button) */
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #666;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.wp-assessment-back-btn:hover {
    color: #333;
}

.wp-assessment-back-btn:active {
    color: #000;
}

/* Text Input Fields */
.wp-assessment-text-input,
.wp-assessment-number-input,
.wp-assessment-textarea-input {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.wp-assessment-text-input:focus,
.wp-assessment-number-input:focus,
.wp-assessment-textarea-input:focus {
    outline: none;
    border-color: #0073aa;
}

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

/* Results */
.wp-assessment-results {
    text-align: center;
}

.wp-assessment-results h3 {
    color: #0073aa;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.wp-assessment-results-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    margin: 2rem 0;
    font-family: monospace;
    font-size: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    resize: vertical;
}

.wp-assessment-restart-btn {
    order: 1; /* Show first (same position as continue button) */
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wp-assessment-restart-btn:hover {
    background: #e5e5e5;
    border-color: #ccc;
}

.wp-assessment-restart-btn:active {
    background: #ddd;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .wp-assessment-radio-options,
    .wp-assessment-checkbox-options {
        gap: 0.75rem;
    }
}

/* Debug Panel */
.wp-assessment-debug {
    background: #1e1e1e;
    color: #d4d4d4;
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.wp-assessment-debug-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 80vh;
    overflow: hidden;
    z-index: 9999;
    margin: 0;
}

.wp-assessment-debug-header {
    background: #ff6b6b;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    cursor: move;
}

.wp-assessment-debug-toggle {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
}

.wp-assessment-debug-toggle:hover {
    opacity: 0.8;
}

.wp-assessment-debug-content {
    padding: 16px;
    max-height: calc(80vh - 48px);
    overflow-y: auto;
}

.wp-assessment-debug.collapsed .wp-assessment-debug-content {
    display: none;
}

.wp-assessment-debug.collapsed .wp-assessment-debug-toggle::before {
    content: '+';
}

.wp-assessment-debug-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #333;
}

.wp-assessment-debug-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.wp-assessment-debug-section h4 {
    margin: 0 0 8px;
    color: #ff6b6b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-assessment-debug-section h4 .count {
    color: #4ec9b0;
    font-weight: normal;
}

.wp-assessment-debug-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    line-height: 1.4;
}

.wp-assessment-debug-item .label {
    color: #9cdcfe;
    font-weight: 600;
}

.wp-assessment-debug-item .value {
    color: #ce9178;
    font-weight: normal;
}

.wp-assessment-debug-journey {
    padding: 8px;
    background: #252526;
    border-radius: 4px;
    min-height: 40px;
}

.wp-assessment-debug-journey em {
    color: #666;
}

.wp-assessment-debug-journey-step {
    padding: 12px;
    margin-bottom: 12px;
    background: #1e1e1e;
    border-radius: 4px;
    border-left: 3px solid #0073aa;
}

.wp-assessment-debug-journey-step:last-child {
    margin-bottom: 0;
}

.wp-assessment-debug-journey-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.wp-assessment-debug-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 12px;
    flex-shrink: 0;
}

.wp-assessment-debug-step-name {
    color: #4ec9b0;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-assessment-debug-journey-question {
    color: #9cdcfe;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
}

.wp-assessment-debug-journey-answer {
    display: flex;
    gap: 6px;
    padding: 6px 0;
}

.wp-assessment-debug-journey-answer .label {
    color: #858585;
    font-size: 12px;
}

.wp-assessment-debug-journey-answer .value {
    color: #ce9178;
    font-weight: 600;
}

.wp-assessment-debug-journey-fields {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #333;
}

.wp-assessment-debug-field-value {
    display: flex;
    gap: 6px;
    padding: 4px 0;
    font-size: 12px;
}

.wp-assessment-debug-field-value .label {
    color: #858585;
}

.wp-assessment-debug-field-value .value {
    color: #b5cea8;
}

/* Mobile debug panel */
@media (max-width: 640px) {
    .wp-assessment-debug-fixed {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        bottom: 10px;
    }
}
