/* ==============================================
   PROFILE SETTINGS PAGE STYLES
   ============================================== */

/* Loading State */
.settings-loading {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.settings-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 180, 255, 0.2);
    border-top-color: #00b4ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Page Layout */
.settings-page {
    background: #f8fafc;
    min-height: 100vh;
    min-height: 100dvh;
}

body.dark-mode .settings-page {
    background: #0f172a;
}

/* ==============================================
   HERO SECTION
   ============================================== */

.settings-hero {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.settings-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #00b4ff 0%, #0066cc 100%);
}

.settings-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
}

.settings-hero-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(80px + 3rem) 1.5rem 2.5rem;
    text-align: center;
}

.settings-hero-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    backdrop-filter: blur(10px);
}

.settings-hero-icon i {
    font-size: 2.5rem;
    color: white;
}

.settings-hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    margin: 0 0 0.5rem;
    letter-spacing: -0.5px;
}

.settings-hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ==============================================
   MAIN CONTENT
   ============================================== */

.settings-content {
    padding: 2rem 1rem 4rem;
}

.settings-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ==============================================
   TAB NAVIGATION
   ============================================== */

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

body.dark-mode .settings-tabs {
    background: #1e293b;
}

.settings-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.settings-tab:hover {
    background: #f1f5f9;
    color: #334155;
}

body.dark-mode .settings-tab:hover {
    background: #334155;
    color: #e2e8f0;
}

.settings-tab.active {
    background: #00b4ff;
    color: white;
}

.settings-tab i {
    font-size: 1.1rem;
}

/* ==============================================
   SETTINGS PANEL
   ============================================== */

.settings-panel {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
}

body.dark-mode .settings-panel {
    background: #1e293b;
}

.settings-section {
    max-width: 100%;
}

/* ==============================================
   ALERTS
   ============================================== */

.settings-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.settings-alert.success {
    background: #dcfce7;
    color: #166534;
}

.settings-alert.error {
    background: #fee2e2;
    color: #991b1b;
}

body.dark-mode .settings-alert.success {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

body.dark-mode .settings-alert.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.settings-alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.settings-alert span {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-close:hover {
    opacity: 1;
}

/* ==============================================
   SETTINGS CARDS
   ============================================== */

.settings-card {
    background: #f8fafc;
    border-radius: 0.875rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.settings-card:hover {
    border-color: #cbd5e1;
}

body.dark-mode .settings-card {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .settings-card:hover {
    border-color: #475569;
}

.settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, white 100%);
    border-bottom: 1px solid #e2e8f0;
}

body.dark-mode .settings-card-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom-color: #334155;
}

.settings-card-header > i {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00b4ff 0%, #0066cc 100%);
    color: white;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.settings-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.25rem;
}

body.dark-mode .settings-card-header h3 {
    color: #f1f5f9;
}

.settings-card-header p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.settings-card-content {
    padding: 1.25rem;
}

/* ==============================================
   AVATAR EDITOR
   ============================================== */

.avatar-editor {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.avatar-preview-container {
    position: relative;
    flex-shrink: 0;
}

.avatar-preview-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark-mode .avatar-preview-img {
    border-color: #1e293b;
}

.avatar-remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.avatar-remove-btn:hover:not(:disabled) {
    background: #dc2626;
    transform: scale(1.1);
}

.avatar-remove-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.dark-mode .avatar-remove-btn {
    border-color: #1e293b;
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.avatar-upload-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.5rem;
}

.avatar-actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #00b4ff 0%, #0066cc 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 180, 255, 0.3);
}

.avatar-info {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.avatar-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

body.dark-mode .avatar-error {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

@media (max-width: 640px) {
    .avatar-editor {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .avatar-actions {
        width: 100%;
        align-items: center;
    }

    .btn-upload {
        width: 100%;
    }
}

/* ==============================================
   FORM ELEMENTS
   ============================================== */

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

body.dark-mode .form-group label {
    color: #e2e8f0;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    color: #1e293b;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

body.dark-mode .form-input,
body.dark-mode .form-select {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #00b4ff;
    box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.15);
}

.form-input::placeholder {
    color: #94a3b8;
}

.form-hint {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 1rem;
}

body.dark-mode .form-hint {
    background: #0f172a;
    color: #94a3b8;
}

.form-hint i {
    color: #00b4ff;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
}

body.dark-mode .form-actions {
    border-top-color: #334155;
}

/* ==============================================
   BUTTONS
   ============================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #00b4ff 0%, #0066cc 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 180, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==============================================
   PASSWORD REQUIREMENTS
   ============================================== */

.password-requirements {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
}

body.dark-mode .password-requirements {
    background: #0f172a;
    border-color: #334155;
}

.password-requirements h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.75rem;
}

body.dark-mode .password-requirements h4 {
    color: #e2e8f0;
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.password-requirements li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.password-requirements li.valid {
    color: #16a34a;
}

.password-requirements li i {
    font-size: 1rem;
}

/* ==============================================
   VISIBILITY OPTIONS
   ============================================== */

.visibility-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 480px) {
    .visibility-options {
        grid-template-columns: 1fr;
    }
}

.visibility-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.dark-mode .visibility-option {
    background: #0f172a;
    border-color: #334155;
}

.visibility-option:hover {
    border-color: #00b4ff;
}

.visibility-option.active {
    border-color: #00b4ff;
    background: rgba(0, 180, 255, 0.05);
}

body.dark-mode .visibility-option.active {
    background: rgba(0, 180, 255, 0.1);
}

.visibility-option i {
    font-size: 2rem;
    color: #64748b;
}

.visibility-option.active i {
    color: #00b4ff;
}

.visibility-option .option-label {
    font-weight: 700;
    color: #1e293b;
}

body.dark-mode .visibility-option .option-label {
    color: #f1f5f9;
}

.visibility-option .option-desc {
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
}

/* ==============================================
   TOGGLE SWITCH
   ============================================== */

.toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.toggle-row:hover {
    border-color: #00b4ff;
}

body.dark-mode .toggle-row {
    background: #0f172a;
    border-color: #334155;
}

.toggle-row.compact {
    padding: 0.75rem 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    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: #cbd5e1;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.toggle-label {
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.dark-mode .toggle-label {
    color: #f1f5f9;
}

.toggle-label i {
    font-size: 1.1rem;
}

.toggle-desc {
    font-size: 0.85rem;
    color: #64748b;
}

/* ==============================================
   SECTION DIVIDER
   ============================================== */

.settings-section-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem 0 1.5rem;
    padding: 1rem 0;
    border-top: 2px solid #e2e8f0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

body.dark-mode .settings-section-divider {
    border-top-color: #334155;
    color: #f1f5f9;
}

.settings-section-divider i {
    color: #00b4ff;
    font-size: 1.25rem;
}

/* ==============================================
   RESPONSIVE
   ============================================== */

@media (max-width: 768px) {
    .settings-hero-title {
        font-size: 2rem;
    }

    .settings-tabs {
        gap: 0.25rem;
        padding: 0.375rem;
    }

    .settings-tab {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    .settings-tab span {
        display: none;
    }

    .settings-tab i {
        font-size: 1.25rem;
    }

    .settings-panel {
        padding: 1rem;
    }

    .avatar-editor {
        flex-direction: column;
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .settings-hero-container {
        padding: calc(80px + 2rem) 1rem 2rem;
    }

    .settings-hero-icon {
        width: 60px;
        height: 60px;
    }

    .settings-hero-icon i {
        font-size: 2rem;
    }

    .settings-hero-title {
        font-size: 1.75rem;
    }

    .settings-card-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .settings-card-header > i {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Delete Account (App Store Review Guideline 5.1.1(v)) */
.delete-account-card {
    border: 1px solid rgba(220, 53, 69, 0.25);
}

body.dark-mode .delete-account-card {
    border-color: rgba(220, 53, 69, 0.4);
}

.delete-account-copy {
    margin: 0 0 0.75rem 0;
    color: var(--text-secondary, #4b5563);
    line-height: 1.5;
}

body.dark-mode .delete-account-copy {
    color: var(--text-secondary, #9ca3af);
}

.delete-account-ack {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.75rem 0 1rem 0;
    color: var(--text-primary, #1f2937);
    cursor: pointer;
}

.delete-account-ack input[type="checkbox"] {
    margin-top: 0.25rem;
    cursor: pointer;
}

body.dark-mode .delete-account-ack {
    color: var(--text-primary, #f1f5f9);
}

.delete-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-account-btn:hover:not(:disabled) {
    background: #c62a39;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.delete-account-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
