/**
 * CSS per il form delle preferenze HairColorGPT
 * 
 * Stili per il form delle preferenze utente con design moderno e responsive
 */

.hcgpt-preferences-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.hcgpt-preferences-form-wrapper {
    background: var(--hcgpt-app-bg);
    color: var(--hcgpt-color-text);
}

.hcgpt-preferences-form-wrapper :is(h1, h2, h3) {
    font-family: var(--hcgpt-font-heading);
}

/* App shell (/app -> Settings -> Personalization):
   keep this view aligned with Shared/Archive rhythm (centered, 2 columns, tighter top spacing). */
#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper {
    margin: 0 auto;
    max-width: min(800px, 100%);
    padding-top: clamp(18px, 2.2vw, 30px);
    padding-bottom: clamp(8px, 1.2vw, 14px);
    width: 100%;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-header,
#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-form {
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-header {
    margin-bottom: 18px;
    text-align: left;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-grid {
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preference-card {
    padding: 16px;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-actions {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-actions .hcgpt-preferences-message,
#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-actions .preferences-status {
    margin: 0;
    max-width: 560px;
    width: 100%;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-save-preferences-btn {
    background: transparent !important;
    border: 1px solid var(--hcgpt-color-border-strong) !important;
    border-radius: 10px !important;
    color: var(--hcgpt-color-text) !important;
    font-weight: var(--hcgpt-font-weight-semibold);
    min-width: 220px;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-save-preferences-btn:hover {
    background: var(--hcgpt-color-surface-2) !important;
    border-color: var(--hcgpt-color-border-strong) !important;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-select,
#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preference-input {
    background: var(--hcgpt-color-surface) !important;
    border: 1px solid var(--hcgpt-color-border) !important;
    color: var(--hcgpt-color-text) !important;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-select:focus,
#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preference-input:focus {
    border-color: var(--hcgpt-color-border-strong) !important;
    box-shadow: none !important;
    outline: none;
}

#hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-select option {
    background: var(--hcgpt-color-surface) !important;
    color: var(--hcgpt-color-text) !important;
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input {
    height: auto;
    padding: 0;
    line-height: 1.45;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--hcgpt-color-border-strong) var(--hcgpt-color-surface-2);
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input option {
    background: var(--hcgpt-color-surface) !important;
    color: var(--hcgpt-color-text) !important;
    line-height: 1.4;
    min-height: 1.9em;
    padding: 8px 12px;
    white-space: normal;
    word-break: break-word;
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input option:checked {
    background: var(--hcgpt-color-surface-2) !important;
    color: var(--hcgpt-color-text) !important;
    box-shadow: inset 3px 0 0 var(--hcgpt-color-border-strong);
    font-weight: 600;
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input::-webkit-scrollbar {
    width: 10px;
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input::-webkit-scrollbar-track {
    background: var(--hcgpt-color-surface-2);
    border-radius: 8px;
}

#hcgpt-preferences-form select[multiple].hcgpt-preference-input::-webkit-scrollbar-thumb {
    background: var(--hcgpt-color-border-strong);
    border-radius: 8px;
    border: 2px solid var(--hcgpt-color-surface-2);
}

/* Keep preferences canvas stable and neutral in dark/system-dark mode */
.hcgpt-preferences-form-wrapper.hcgpt-scope[data-hcgpt-theme="dark"] {
    --hcgpt-color-bg: #000;
    --hcgpt-app-bg: #000;
    background: #000;
}

@media (prefers-color-scheme: dark) {
    .hcgpt-preferences-form-wrapper.hcgpt-scope[data-hcgpt-theme="system"] {
        --hcgpt-color-bg: #000;
        --hcgpt-app-bg: #000;
        background: #000;
    }
}

.hcgpt-preferences-header {
    text-align: center;
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    color: var(--hcgpt-color-text);
    border-radius: 0;
    box-shadow: none;
}

.hcgpt-preferences-header h2 {
    margin: 0 0 8px 0;
    font-size: clamp(1.8rem, 2.5vw, 2.2rem);
    font-weight: 600;
    color: var(--hcgpt-color-text);
}

.hcgpt-preferences-header p {
    margin: 0;
    font-size: 1.1em;
    opacity: 1;
    color: var(--hcgpt-color-text-muted);
}

.hcgpt-preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 30px;
}

.hcgpt-preference-card {
    background: var(--hcgpt-color-surface);
    border-radius: var(--hcgpt-radius-md);
    padding: 25px;
    border: 1px solid var(--hcgpt-color-border);
    transition: border-color var(--hcgpt-transition-fast);
}

.hcgpt-preference-card.hcgpt-field {
    margin-bottom: 0;
}

.hcgpt-preference-card:hover {
    border-color: var(--hcgpt-color-border-strong);
}

.hcgpt-preference-card h3,
.hcgpt-preference-card p {
    margin: 0;
}

.hcgpt-preference-card h3 {
    font-weight: 600;
}

.hcgpt-preference-card .hcgpt-pref-label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.hcgpt-preference-card .hcgpt-pref-label-icon {
    color: var(--hcgpt-color-text-muted);
    flex: 0 0 18px;
    font-size: 18px;
    height: 18px;
    line-height: 18px;
    width: 18px;
}

.hcgpt-preference-card p {
    line-height: 1.4;
}

.hcgpt-preferences-actions {
    padding: 25px 30px;
    background: var(--hcgpt-color-surface-2);
    border-top: 1px solid var(--hcgpt-color-border);
    text-align: center;
}

.hcgpt-save-preferences-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.hcgpt-preferences-message,
.preferences-status {
    margin-top: var(--hcgpt-space-3);
    text-align: center;
}

.hcgpt-preferences-message {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .hcgpt-preferences-container {
        padding: 15px;
    }
    
    .hcgpt-preferences-header {
        padding: 0;
    }
    
    .hcgpt-preferences-header h2 {
        font-size: 1.8em;
    }
    
    .hcgpt-preferences-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .hcgpt-preference-card {
        padding: 20px;
    }
    
    .hcgpt-preferences-actions {
        padding: 20px;
    }
    
    .hcgpt-save-preferences-btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    #hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper {
        max-width: 100%;
    }

    #hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    #hcgpt-app-view-settings .hcgpt-us-panel-body .hcgpt-preferences-form-wrapper .hcgpt-preferences-header h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .hcgpt-preferences-header h2 {
        font-size: 1.5em;
    }
    
    .hcgpt-preferences-header p {
        font-size: 1em;
    }
    
}

/* Loading States */
.hcgpt-preferences-form.submitting {
    opacity: 0.7;
    pointer-events: none;
}

.hcgpt-preferences-form.submitting .hcgpt-save-preferences-btn {
    cursor: not-allowed;
    opacity: 0.7;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .hcgpt-preference-card {
        border: 2px solid #000;
    }
    
    .hcgpt-select {
        border: 2px solid #000;
    }
    
    .hcgpt-save-preferences-btn {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .hcgpt-preference-card,
    .hcgpt-save-preferences-btn,
    .hcgpt-preferences-message {
        transition: none;
    }
    
    .hcgpt-preference-card:hover {
        transform: none;
    }
    
    .hcgpt-save-preferences-btn:hover {
        transform: none;
    }
} 
