/**
 * Choicery Component Library
 *
 * Enhanced component system building on the base style.css
 * Provides reusable, accessible components for rapid development
 *
 * Import this after style.css and sidebar.css:
 * <link href="{{ url_for('static', filename='css/components.css') }}" rel="stylesheet">
 */

/* ==================== CANONICAL COMPONENTS ==================== */
.workspace-shell {
    display: flex;
    min-height: calc(100vh - var(--header-height, 64px));
    min-width: 0;
}

.workspace-sidebar {
    flex: 0 0 var(--workspace-sidebar-width, var(--sidebar-width, 260px));
    min-width: 0;
    overflow: hidden;
}

.workspace-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.workspace-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 992px) {
    .workspace-shell {
        display: block;
        min-height: auto;
    }

    .workspace-sidebar,
    .workspace-main,
    .workspace-scroll {
        overflow: visible;
    }
}

.c-card {
    background: var(--surface-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-card);
    box-shadow: var(--elevation-sm);
    color: var(--text-default);
    overflow: hidden;
}

.c-card-header,
.c-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--surface-panel-subtle);
}

.c-card-header {
    border-bottom: 1px solid var(--border-default);
}

.c-card-footer {
    border-top: 1px solid var(--border-default);
}

.c-card-body {
    padding: var(--space-5);
}

.c-card-muted {
    background: var(--surface-panel-subtle);
}

.c-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 38px;
    padding: var(--space-2) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.c-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.c-btn:disabled,
.c-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
}

.c-btn-primary {
    background: var(--button-primary-bg);
    border-color: var(--button-primary-border);
    color: var(--button-primary-text);
}

.c-btn-primary:hover {
    background: var(--button-primary-bg-hover);
    border-color: var(--button-primary-border-hover);
    color: var(--button-primary-text);
}

.c-btn-secondary {
    background: var(--button-secondary-bg);
    border-color: var(--button-secondary-border);
    color: var(--button-secondary-text);
}

.c-btn-secondary:hover {
    background: var(--button-secondary-bg-hover);
    border-color: var(--button-secondary-border-hover);
    color: var(--button-secondary-text);
}

.c-btn-success {
    background: var(--button-success-bg);
    border-color: var(--button-success-border);
    color: var(--button-success-text);
}

.c-btn-success:hover {
    background: var(--button-success-bg-hover);
    border-color: var(--button-success-border-hover);
    color: var(--button-success-text);
}

.c-btn-danger {
    background: var(--button-danger-bg);
    border-color: var(--button-danger-border);
    color: var(--button-danger-text);
}

.c-btn-danger:hover {
    background: var(--button-danger-bg-hover);
    border-color: var(--button-danger-border-hover);
    color: var(--button-danger-text);
}

/* Low-emphasis destructive action (e.g. delete inside a modal footer). */
.c-btn-outline-danger {
    background: transparent;
    border-color: var(--danger-100);
    color: var(--danger-500);
}

.c-btn-outline-danger:hover {
    background: var(--danger-50);
    border-color: var(--danger-200);
    color: var(--danger-600);
}

.c-btn-ghost {
    background: transparent;
    color: var(--button-ghost-text);
}

.c-btn-ghost:hover {
    background: var(--button-ghost-bg-hover);
    color: var(--button-ghost-text);
}

.c-btn-sm {
    min-height: 30px;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-sm);
}

.c-btn-lg {
    min-height: 46px;
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-size-lg);
}

.c-field {
    display: grid;
    gap: var(--space-2);
}

.c-label {
    color: var(--text-default);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.c-input,
.c-select {
    width: 100%;
    min-height: 38px;
    padding: var(--space-2) var(--space-3);
    background: var(--surface-panel);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-default);
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.c-input:focus,
.c-select:focus {
    border-color: var(--selected-border);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    outline: 0;
}

.c-input::placeholder {
    color: var(--text-placeholder);
}

.c-help {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-body);
}

.c-error {
    color: var(--danger-600);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-body);
}

.c-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.c-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: end;
}

.c-pill,
.c-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    white-space: nowrap;
}

.c-pill {
    background: var(--pill-default-bg);
    border-color: var(--pill-default-border);
    color: var(--pill-default-text);
    padding: var(--space-1) var(--space-3);
}

.c-badge {
    background: var(--badge-default-bg);
    border-color: var(--badge-default-border);
    color: var(--badge-default-text);
    padding: 3px var(--space-2);
}

.c-pill-primary {
    background: var(--pill-primary-bg);
    border-color: var(--pill-primary-border);
    color: var(--pill-primary-text);
}

.c-badge-primary {
    background: var(--badge-primary-bg);
    border-color: var(--badge-primary-border);
    color: var(--badge-primary-text);
}

.c-pill-success {
    background: var(--pill-success-bg);
    border-color: var(--pill-success-border);
    color: var(--pill-success-text);
}

.c-badge-success {
    background: var(--badge-success-bg);
    border-color: var(--badge-success-border);
    color: var(--badge-success-text);
}

.c-pill-warning {
    background: var(--pill-warning-bg);
    border-color: var(--pill-warning-border);
    color: var(--pill-warning-text);
}

.c-badge-warning {
    background: var(--badge-warning-bg);
    border-color: var(--badge-warning-border);
    color: var(--badge-warning-text);
}

.c-pill-danger {
    background: var(--pill-danger-bg);
    border-color: var(--pill-danger-border);
    color: var(--pill-danger-text);
}

.c-badge-danger {
    background: var(--badge-danger-bg);
    border-color: var(--badge-danger-border);
    color: var(--badge-danger-text);
}

/* ==================== ENHANCED CARDS ==================== */
.card-enhanced {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card-interactive {
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.card-standard .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-bg-light);
}

.card-title {
    margin: 0;
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--color-text);
}

.card-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Status Cards */
.card-status {
    border-left: 4px solid;
    position: relative;
}

.card-status-success {
    border-left-color: var(--color-success);
}

.card-status-warning {
    border-left-color: var(--color-warning);
}

.card-status-danger {
    border-left-color: var(--color-danger);
}

.card-status-info {
    border-left-color: var(--color-info);
}

.card-status .card-body {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.status-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
    margin-top: var(--space-xs);
}

.card-status-success .status-icon {
    color: var(--color-success);
}

.card-status-warning .status-icon {
    color: var(--color-warning);
}

.card-status-danger .status-icon {
    color: var(--color-danger);
}

.card-status-info .status-icon {
    color: var(--color-info);
}

.status-content h6 {
    margin: 0 0 var(--space-xs) 0;
    font-weight: 600;
}

.status-content p {
    margin: 0;
    font-size: var(--font-size-sm);
}

/* ==================== ENHANCED FORMS ==================== */
.form-group-enhanced {
    margin-bottom: var(--space-lg);
}

.form-label.required::after {
    content: " *";
    color: var(--color-danger);
}

.form-help {
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.form-control-enhanced {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: var(--space-sm) var(--space-md);
    transition: all 0.2s ease;
}

.form-control-enhanced:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem var(--brand-tint-20);
    outline: none;
}

/* Input Groups */
.input-group-enhanced {
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.input-group-enhanced .form-control {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.input-group-enhanced .form-control:focus {
    box-shadow: none;
}

.input-group-enhanced .btn {
    border-radius: 0;
    border-left: 1px solid var(--color-border);
}

.input-group-enhanced .btn:first-of-type {
    border-left: none;
}

/* Form Validation States */
.form-control.is-invalid {
    border-color: var(--color-danger);
}

.form-control.is-valid {
    border-color: var(--color-success);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-danger);
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-success);
}

/* ==================== METRIC CARDS ==================== */
.metric-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.metric-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.metric-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.metric-change {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.metric-change.positive {
    color: var(--color-success);
}

.metric-change.negative {
    color: var(--color-danger);
}

.metric-change.neutral {
    color: var(--color-text-muted);
}

/* ==================== ENHANCED TABLES ==================== */
.table-container {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.table-enhanced {
    margin-bottom: 0;
}

.table-enhanced th {
    background-color: var(--color-bg-light);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
    padding: var(--space-md);
}

.table-enhanced td {
    padding: var(--space-md);
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.table-row-interactive {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.table-row-interactive:hover {
    background-color: var(--color-primary-subtle);
}

/* Importance Bar Component */
.importance-bar {
    display: inline-block;
    width: 60px;
    height: 8px;
    background-color: var(--color-bg-subtle);
    border-radius: var(--radius-sm);
    margin-right: var(--space-sm);
    overflow: hidden;
}

.importance-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

/* ==================== SURVEY FLOW COMPONENTS ==================== */
.survey-item-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all 0.2s ease;
    cursor: move;
}

.survey-item-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.survey-item-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.survey-item-handle {
    color: var(--color-text-muted);
    cursor: grab;
    padding: var(--space-xs);
}

.survey-item-handle:active {
    cursor: grabbing;
}

.survey-item-content {
    flex: 1;
    min-width: 0;
}

.survey-item-type {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.survey-item-title {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.survey-item-actions {
    display: flex;
    gap: var(--space-xs);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    background-color: var(--color-bg-light);
    transition: all 0.2s ease;
    cursor: pointer;
    margin-bottom: var(--space-md);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--color-primary);
    background-color: var(--color-primary-subtle);
}

.drop-zone-content {
    color: var(--color-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.drop-zone-content i {
    font-size: var(--font-size-2xl);
    opacity: 0.5;
}

/* ==================== LOADING STATES ==================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-xs);
}

.skeleton-text.wide {
    width: 100%;
}

.skeleton-text.medium {
    width: 75%;
}

.skeleton-text.narrow {
    width: 50%;
}

.skeleton-card {
    height: 200px;
}

.skeleton-button {
    height: 38px;
    width: 120px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* ==================== EMPTY STATES ==================== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: var(--font-size-4xl);
    color: var(--color-text-muted);
    opacity: 0.5;
    margin-bottom: var(--space-lg);
}

.empty-state-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.empty-state-description {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-lg);
}

/* ==================== FLOATING ACTION BUTTON ==================== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    color: white;
    font-size: var(--font-size-lg);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px var(--teal-tint-40);
}

.fab:active {
    transform: scale(0.95);
}

/* ==================== BADGES & CHIPS ==================== */
.chip {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background-color: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text);
    gap: var(--space-xs);
}

.chip-primary {
    background-color: var(--color-primary-subtle);
    border-color: var(--color-primary);
    color: var(--color-primary-dark);
}

.chip-removable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-removable:hover {
    background-color: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.chip-remove {
    appearance: none;
    background: transparent;
    border: 0;
    color: inherit;
    margin-left: var(--space-xs);
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* ==================== PROGRESS INDICATORS ==================== */
.progress-enhanced {
    height: 8px;
    background-color: var(--color-bg-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.progress-bar-enhanced {
    background: var(--color-primary);
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.6s ease;
    position: relative;
}

.progress-bar-enhanced::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        var(--surface-shimmer),
        transparent
    );
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==================== RESPONSIVE UTILITIES ==================== */
@media (max-width: 768px) {
    .metric-card {
        padding: var(--space-md);
    }

    .metric-value {
        font-size: var(--font-size-2xl);
    }

    .survey-item-card {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .survey-item-content {
        order: -1;
    }

    .fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: var(--font-size-base);
    }

    .table-container {
        overflow-x: auto;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .skeleton {
        animation: none;
        background: var(--gray-100);
    }

    .progress-bar-enhanced::after {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card-enhanced {
        border-width: 2px;
    }

    .drop-zone {
        border-width: 3px;
    }

    .form-control:focus {
        border-width: 2px;
    }
}

/* Focus indicators for keyboard navigation */
.card-interactive:focus,
.survey-item-card:focus,
.drop-zone:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .fab,
    .survey-item-handle,
    .survey-item-actions,
    .drop-zone {
        display: none !important;
    }

    .card-enhanced,
    .table-container {
        box-shadow: none !important;
        border: 1px solid var(--gray-900) !important;
    }
}

/* ==================== BRAND CARD HOVER UTILITY ==================== */
/* Opt-in utility for clickable/selectable admin cards. Apply to elements
   that already have a border and react to clicks. Reine Inhaltskarten nicht
   damit ausstatten - dann wirkt der Hover irrefuehrend. */

.u-hover-lift {
    transition:
        border-color var(--admin-motion-standard),
        box-shadow var(--admin-motion-standard),
        transform var(--admin-motion-standard);
}

.u-hover-lift:hover {
    border-color: var(--admin-brand-primary);
    box-shadow: var(--admin-card-hover-shadow);
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .u-hover-lift,
    .u-hover-lift:hover {
        transition: none;
        transform: none;
    }
}

/* ==================== SAVE TOOLBAR (shared) ==================== */
/* Dirty-aware save toolbar, Settings-page pattern (see settings.css
   .settings-save-* and the PE editor .pe-save-*). Markup macro:
   components/_save_toolbar.html; behavior: js/configurator/save_toolbar.js.
   Right-aligned strip at the top of the form it saves. Not sticky
   (intentional, matches Project Settings). */
.config-save-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
    margin: 0 0 var(--space-md);
    padding: 0 0 var(--space-sm);
    border-bottom: 1px solid var(--border-default);
}

.config-save-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    white-space: nowrap;
}

.config-save-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success-500) 18%, transparent);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.config-save-status.is-dirty {
    color: var(--warning-700);
    font-weight: var(--font-weight-semibold);
}
.config-save-status.is-dirty .config-save-status-dot {
    background: var(--warning-500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning-500) 22%, transparent);
}

.config-save-status.is-saving {
    color: var(--text-muted);
}
.config-save-status.is-saving .config-save-status-dot {
    background: var(--gray-400);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gray-400) 22%, transparent);
    animation: config-save-pulse 0.9s ease-in-out infinite;
}

@keyframes config-save-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

.config-save-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 14px;
    background: var(--button-success-bg);
    color: var(--button-success-text);
    border: 1px solid var(--button-success-border);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.config-save-primary:hover:not(:disabled) {
    background: var(--button-success-bg-hover);
    border-color: var(--button-success-border-hover);
}

.config-save-primary:active:not(:disabled) {
    transform: translateY(1px);
}

/* 0.45 opacity on top of an already muted foreground pushed the label under
   the contrast floor and read as "broken" rather than "not available yet".
   The muted palette alone carries the state. */
.config-save-primary:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background: var(--surface-panel);
    color: var(--text-muted);
    border-color: var(--border-default);
}

.config-save-primary i {
    font-size: 14px;
}

.config-save-toolbar--button-only {
    margin: 0;
    padding: 0;
    border-bottom: 0;
}

/* Inline autosave status (rendered by autosave.js into #autosave-status).
   Sits right-aligned above the configurator tab content. */
.config-autosave-status {
    display: flex;
    justify-content: flex-end;
    min-height: 20px;
    margin-bottom: var(--space-xs);
    font-size: 12.5px;
}
/* Collapse while empty so it doesn't reserve a grey strip above the tab content
   (autosave.js fills it with "Saving…/Saved" only on editable tabs; on read-only
   tabs like Preview it stays empty). Without this the top inset is taller than the
   left/right insets. */
.config-autosave-status:empty {
    display: none;
}

@media (max-width: 640px) {
    .config-save-toolbar {
        justify-content: space-between;
        gap: var(--space-sm);
    }
}

/* Result notes: methodological hints and soft warnings on analysis result pages,
   collapsed into one quiet line (components/_results_notes.html, LC renders the same markup in JS). */
.results-notes {
    margin: 0 0 var(--space-sm);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.results-notes > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    list-style: none;
    color: var(--interactive-color);
    user-select: none;
}

.results-notes > summary::-webkit-details-marker {
    display: none;
}

.results-notes > summary:hover {
    color: var(--interactive-color-hover);
}

.results-notes > summary .results-notes-chevron {
    font-size: 0.6875rem;
    transition: transform 0.15s ease;
}

.results-notes[open] > summary .results-notes-chevron {
    transform: rotate(90deg);
}

.results-notes-list {
    margin: var(--space-xs) 0 0;
    padding-left: 1.25rem;
    line-height: 1.5;
}

.results-notes-list > li + li {
    margin-top: 0.25rem;
}

.results-notes-list .btn {
    margin-left: 0.25rem;
}
