/* Widget System CSS - All interactive widgets */

/* =================================================================
   NO-JS GRACEFUL DEGRADATION
   Content remains readable, interactive features hidden
   ================================================================= */

/* Fallback message - shown only when JS disabled */
.widget-noscript {
    display: none;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed #f59e0b;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #92400e;
}

[data-theme="dark"] .widget-noscript {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

/* When JS is disabled, show the noscript message */
html.no-js .widget-noscript {
    display: block;
}

/* Hide JS-only interactive elements when no JS */
html.no-js .widget-result,
html.no-js .widget-output,
html.no-js .widget-verdict {
    display: none;
}

/* Checkboxes still work without JS - keep them but style as static */
html.no-js .widget-item {
    cursor: default;
}

/* Calculator inputs visible but non-functional */
html.no-js .widget-input-field {
    cursor: not-allowed;
    opacity: 0.7;
}

/* =================================================================
   BASE STYLES
   ================================================================= */

/* Base container */
.widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.widget-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Sections */
.widget-section {
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 3px solid var(--section-color, var(--border-color));
}

.widget-section-header {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Items (checkboxes) */
.widget-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.3rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.widget-item input[type="checkbox"] {
    margin-top: 0.2rem;
    cursor: pointer;
}

/* Results area */
.widget-result {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

/* Score display (for comparison widgets) */
.widget-scores {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
}

.widget-score {
    text-align: center;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--section-color) 10%, transparent);
}

.widget-score-val {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--section-color);
}

[data-theme="dark"] .widget-score-val {
    color: var(--section-color-dark, var(--section-color));
}

.widget-score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 500;
}

/* Single total score (for threshold widgets) */
.widget-total {
    text-align: center;
    margin-bottom: 1rem;
}

.widget-total-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.widget-total-val {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Verdict */
.widget-verdict {
    padding: 0.75rem;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
}

.widget-verdict.good {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
}

.widget-verdict.bad {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.widget-verdict.mixed {
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
}

[data-theme="dark"] .widget-verdict.good { color: #4ade80; }
[data-theme="dark"] .widget-verdict.bad { color: #f87171; }
[data-theme="dark"] .widget-verdict.mixed { color: #fbbf24; }

/* Calculator-specific */
.widget-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.widget-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.widget-input-label {
    flex: 1;
    min-width: 150px;
    font-size: 0.9rem;
}

.widget-input-field {
    width: 120px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.widget-input-field:focus {
    outline: none;
    border-color: var(--accent-color, #3b82f6);
}

.widget-output {
    text-align: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.widget-output-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.widget-output-val {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 480px) {
    .widget-scores {
        gap: 1rem;
    }

    .widget-score {
        padding: 0.5rem 1rem;
    }

    .widget-score-val {
        font-size: 1.5rem;
    }

    .widget-input-field {
        width: 100px;
    }
}
