/* css/settings.css - Redesigned Settings Page v2.1 */
/* Warm, trustworthy, user-controlled */
/* FIXES: Preferences layout, Values grid with icons, Wider textareas */

/* ============================================ */
/* BASE & CONTAINER */
/* ============================================ */

.settings-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Override base.css rule that sets padding-top: 0 for main inside app-container */
.app-container .settings-container {
    padding-top: 5rem;
}

/* ============================================ */
/* HEADER & TRUST BANNER */
/* ============================================ */

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h1 {
    color: #1a1a2e;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.settings-subtitle {
    color: #6c757d;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.trust-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
}

.trust-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.trust-content strong {
    color: #065f46;
    font-size: 1rem;
    display: block;
    margin-bottom: 0.25rem;
}

.trust-content p {
    color: #047857;
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================ */
/* COLLAPSIBLE SECTIONS */
/* ============================================ */

.settings-section {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.settings-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.section-header:hover {
    background-color: #f9fafb;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-icon {
    font-size: 1.5rem;
}

.section-title h2 {
    color: #1a1a2e;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.section-toggle {
    color: #9ca3af;
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.settings-section[data-expanded="true"] .section-toggle {
    transform: rotate(0deg);
}

.settings-section[data-expanded="false"] .section-toggle,
.settings-section .section-toggle {
    transform: rotate(-90deg);
}

.settings-section[data-expanded="true"] .section-toggle {
    transform: rotate(0deg);
}

.section-content {
    padding: 0 1.5rem 1.5rem;
    max-height: 2000px;
    opacity: 1;
    transition: all 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
}

.section-intro {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

/* ============================================ */
/* SETTING ROWS */
/* ============================================ */

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 2rem;
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-info {
    flex: 0 0 200px;
    min-width: 0;
}

.setting-info label {
    color: #1a1a2e;
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.25rem;
}

.setting-hint {
    color: #6c757d;
    font-size: 0.8rem;
    margin: 0;
}

.setting-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

/* Inputs */
.setting-input,
.setting-select,
.setting-textarea {
    padding: 0.6rem 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1a1a2e;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.setting-input:focus,
.setting-select:focus,
.setting-textarea:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.setting-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.setting-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Read-only value */
.readonly-value {
    color: #6c757d;
    font-size: 0.95rem;
}

/* Save indicator */
.save-indicator {
    color: #10b981;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.save-indicator.visible {
    opacity: 1;
}

/* Encrypted badge */
.encrypted-badge {
    font-size: 0.9rem;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Sensitive fields */
.sensitive-field {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
    margin: 0.5rem -1.5rem;
    padding: 1rem 1.5rem !important;
    border-radius: 0;
}

.sensitive-note {
    color: #92400e;
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Highlight row */
.highlight-row {
    background: #f0fdf4;
    margin: 0 -1.5rem;
    padding: 1rem 1.5rem !important;
}

/* ============================================ */
/* TOGGLE SWITCH */
/* ============================================ */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #10b981;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-label {
    color: #6c757d;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* ============================================ */
/* RADIO OPTIONS (Communication Style) - FIXED */
/* ============================================ */

.communication-row {
    flex-direction: column;
    gap: 1rem;
}

.communication-row .setting-info {
    flex: none;
    width: 100%;
}

.communication-row .setting-control {
    width: 100%;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: #e94560;
    background: #fff5f7;
}

.radio-option input[type="radio"] {
    accent-color: #e94560;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.radio-option.selected,
.radio-option:has(input:checked) {
    border-color: #e94560;
    background: #fff5f7;
}

.radio-text {
    flex: 1;
}

.radio-label {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.9rem;
    display: block;
}

.radio-hint {
    color: #6c757d;
    font-size: 0.8rem;
    display: block;
    margin-top: 0.125rem;
}

/* ============================================ */
/* VALUES GRID - WITH ICONS (Like Onboarding) */
/* ============================================ */

.values-row {
    flex-direction: column;
    gap: 1rem;
}

.values-row .setting-info {
    width: 100%;
    flex: none;
}

.values-row .setting-control {
    width: 100%;
}

.values-counter {
    color: #e94560;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.value-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #4b5563;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 70px;
}

.value-chip:hover {
    border-color: #e94560;
    background: #fff5f7;
    transform: translateY(-2px);
}

.value-chip.selected {
    border-color: #e94560;
    background: linear-gradient(135deg, #fff5f7 0%, #fce7eb 100%);
    color: #e94560;
    font-weight: 600;
}

.value-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.value-label {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* ============================================ */
/* FULL-WIDTH TEXTAREA ROWS (Hobbies, Goals, etc) */
/* ============================================ */

.textarea-row {
    flex-direction: column;
    gap: 0.75rem;
}

.textarea-row .setting-info {
    width: 100%;
    flex: none;
}

.textarea-row .setting-control {
    width: 100%;
}

.textarea-row .setting-textarea {
    width: 100%;
    min-height: 100px;
}

/* ============================================ */
/* DATA CATEGORY ITEMS (Manage Your Data) */
/* ============================================ */

.data-categories {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.data-category-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.data-category-item:hover {
    border-color: #e94560;
    background: #fefefe;
}

.data-category-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.data-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.data-info {
    flex: 1;
    min-width: 0;
}

.data-info strong {
    display: block;
    color: #1a1a2e;
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}

.data-count {
    color: #6c757d;
    font-size: 0.85rem;
    display: block;
}

.data-warning {
    color: #dc2626;
    font-size: 0.8rem;
    font-style: italic;
    display: block;
    margin-top: 0.25rem;
}

.data-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #e94560;
    cursor: pointer;
    flex-shrink: 0;
}

.data-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    align-items: center;
    flex-wrap: wrap;
}

.data-disclaimer {
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* ============================================ */
/* EXPORT DATA */
/* ============================================ */

.export-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.export-info {
    flex: 1;
}

.export-info p {
    color: #4b5563;
    margin-bottom: 1rem;
}

.export-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.export-list li {
    color: #6c757d;
    font-size: 0.9rem;
    padding: 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-list li::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
}

.export-note {
    color: #9ca3af;
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.75rem;
}

/* ============================================ */
/* SUPPORT SECTION */
/* ============================================ */

.support-section {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 2px solid #10b981;
}

.support-section .section-header {
    padding: 0;
}

.support-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.25rem 1.5rem;
    width: 100%;
}

.support-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.support-heart {
    font-size: 2.5rem;
}

.support-content h3 {
    color: #065f46;
    font-size: 1.15rem;
    margin: 0 0 0.25rem;
}

.support-content p {
    color: #047857;
    font-size: 0.9rem;
    margin: 0;
}

.btn-support {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-support:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ============================================ */
/* DANGER ZONE */
/* ============================================ */

.danger-zone {
    border: 2px solid #fecaca;
    background: #fef2f2;
}

.danger-zone .section-header:hover {
    background-color: #fee2e2;
}

.danger-zone .section-title h2 {
    color: #dc2626;
}

.danger-warning {
    color: #dc2626;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.danger-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.danger-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

.danger-info {
    flex: 1;
}

.danger-info strong {
    color: #1a1a2e;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.25rem;
}

.danger-info p {
    color: #6c757d;
    font-size: 0.85rem;
    margin: 0;
}

/* ============================================ */
/* BUTTONS */
/* ============================================ */

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #e94560;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #d63652;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-secondary {
    padding: 0.625rem 1.25rem;
    background: white;
    color: #1a1a2e;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: #1a1a2e;
    background: #f9fafb;
}

.btn-text {
    padding: 0.5rem 1rem;
    background: transparent;
    color: #6c757d;
    border: none;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-text:hover {
    color: #1a1a2e;
}

.btn-warning {
    padding: 0.875rem 2rem;
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    padding: 0.625rem 1.25rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-danger-outline {
    padding: 0.625rem 1.25rem;
    background: white;
    color: #dc2626;
    border: 2px solid #dc2626;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-danger-outline:hover {
    background: #dc2626;
    color: white;
}

/* ============================================ */
/* TOAST NOTIFICATIONS */
/* ============================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: #1a1a2e;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.3s ease;
    font-size: 0.9rem;
}

.toast.success {
    background: #059669;
}

.toast.error {
    background: #dc2626;
}

.toast-icon {
    font-size: 1.1rem;
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100px);
        opacity: 0;
    }
}

/* ============================================ */
/* MODALS */
/* ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
}

.password-modal-content h3 {
    color: #1a1a2e;
    margin: 0 0 0.5rem;
}

.password-modal-content p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #e94560;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-text {
    color: #1a1a2e;
    font-weight: 500;
}

/* ============================================ */
/* STATUS BADGES */
/* ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    background: #d1fae5;
    color: #065f46;
}

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */

@media (max-width: 768px) {
    .settings-container {
        padding: 1rem 1rem 3rem;
    }
    
    .settings-header h1 {
        font-size: 1.75rem;
    }
    
    .trust-banner {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .setting-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .setting-info {
        flex: none;
        width: 100%;
    }
    
    .setting-control {
        width: 100%;
    }
    
    .radio-group {
        width: 100%;
    }
    
    .values-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .value-chip {
        min-height: 60px;
        padding: 0.5rem 0.25rem;
    }
    
    .value-icon {
        font-size: 1.25rem;
    }
    
    .value-label {
        font-size: 0.7rem;
    }
    
    .export-container {
        flex-direction: column;
        text-align: center;
    }
    
    .support-container {
        flex-direction: column;
        text-align: center;
    }
    
    .danger-action {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    
    .toast {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .section-header {
        padding: 1rem;
    }
    
    .section-content {
        padding: 0 1rem 1rem;
    }
    
    .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .value-chip {
        min-height: 55px;
    }
}

/* ============================================ */
/* ADDITIONAL FIX: Radio option highlighting */
/* ============================================ */

.radio-option.selected {
    border-color: #e94560;
    background: linear-gradient(135deg, #fff5f7 0%, #fce7eb 100%);
}

.radio-option.selected .radio-label {
    color: #e94560;
}
