/* ──────────────────────────────────────────
   Settings Modal – follows auth_modal pattern
   ────────────────────────────────────────── */

#settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#settings-modal-overlay.open {
    display: flex;
    opacity: 1;
}

#settings-modal {
    background: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    padding: 1.5rem;
    position: relative;
    border: 1px solid #e2e8f0;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0f172a;
    max-height: 85vh;
    overflow-y: auto;
}

.settings-header {
    margin-bottom: 1.25rem;
}

.settings-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
}

.settings-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    padding: 4px;
    border-radius: 4px;
}

.settings-close:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

/* ── Sections ─────────────────────────────── */

.settings-section {
    padding: 1rem 0;
    border-top: 1px solid #e2e8f0;
}

.settings-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.settings-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin: 0 0 0.75rem 0;
}

/* ── Account section ──────────────────────── */

.settings-account-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.settings-account-uid {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.settings-account-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.settings-account-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ── Account switcher ─────────────────────── */

.settings-account-switcher {
    margin-top: 0.5rem;
}

.settings-account-switcher select {
    display: flex;
    height: 2.25rem;
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background-color: transparent;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.settings-account-switcher select:focus {
    outline: none;
    border-color: #0f172a;
}

.settings-account-switcher select option {
    background: #ffffff;
    color: #0f172a;
    padding: 8px;
}

/* ── Data section (Import/Export) ──────────── */

.settings-data-actions {
    display: flex;
    gap: 0.5rem;
}

/* ── Sync section (Relay server) ───────────── */

.settings-relay-select {
    display: flex;
    height: 2.25rem;
    width: 100%;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    background-color: transparent;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.settings-relay-select:focus {
    outline: none;
    border-color: #0f172a;
}

.settings-relay-select option {
    background: #ffffff;
    color: #0f172a;
    padding: 8px;
}

.settings-relay-info {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.375rem;
}

/* ── Shared button styles (matching auth-button) ── */

.settings-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.25rem;
    padding: 0 1rem;
    background-color: #0f172a;
    color: #f8fafc;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.settings-button:hover {
    background-color: #1e293b;
}

.settings-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-button.secondary {
    background-color: #f1f5f9;
    color: #0f172a;
}

.settings-button.secondary:hover {
    background-color: #e2e8f0;
}

.settings-button.danger {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.settings-button.danger:hover {
    background-color: #fee2e2;
}

.settings-button.flex-1 {
    flex: 1;
}

/* ── Message area ─────────────────────────── */

.settings-message {
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    display: none;
}

.settings-message.error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    display: block;
}

.settings-message.success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    display: block;
}

/* ── Hidden file input ─────────────────────── */
#settings-file-import {
    display: none;
}
