/**
 * Enhanced Settings Styles for ALBND
 * PKG-01 Foundation - Settings Enhancement
 * 
 * INSTALLATION:
 * Add to your main CSS file or include as separate file
 */

/* ============================================
   Settings Container Layout
   ============================================ */
.settings-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: calc(100vh - 200px);
}

@media (max-width: 1024px) {
    .settings-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Settings Navigation
   ============================================ */
.settings-nav {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.settings-nav-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.settings-nav-header i {
    color: var(--primary);
    font-size: 1.2rem;
}

.settings-nav-items {
    padding: 12px;
}

.settings-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.settings-nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

.settings-nav-item.active {
    background: var(--primary);
    color: #fff;
}

.settings-nav-item i {
    width: 20px;
    text-align: center;
}

/* ============================================
   Settings Content Area
   ============================================ */
.settings-content {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 24px;
}

.settings-section {
    max-width: 800px;
}

.settings-section-header {
    margin-bottom: 24px;
}

.settings-section-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-section-header h3 i {
    color: var(--primary);
}

.settings-section-header p {
    color: var(--text-secondary, rgba(255,255,255,0.6));
    font-size: 0.9rem;
}

/* ============================================
   Toggle Switches
   ============================================ */
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.toggle-info label {
    color: var(--text-primary);
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.toggle-info p {
    color: var(--text-secondary, rgba(255,255,255,0.5));
    font-size: 0.85rem;
    margin: 0;
}

.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: rgba(255,255,255,0.1);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

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

/* ============================================
   Theme Selector
   ============================================ */
.theme-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.theme-option {
    cursor: pointer;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.theme-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.theme-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.theme-preview {
    height: 100px;
    display: flex;
    padding: 8px;
    gap: 8px;
}

.theme-preview.theme-dark {
    background: var(--bg-secondary);
}

.theme-preview.theme-light {
    background: var(--bg-secondary);
}

.theme-preview.theme-ocean {
    background: linear-gradient(135deg, #0c1929 0%, #1a3344 100%);
}

.theme-preview.theme-emerald {
    background: linear-gradient(135deg, #0a1f17 0%, #153d2e 100%);
}

.theme-preview.theme-purple {
    background: linear-gradient(135deg, #13111c 0%, #262033 100%);
}

.theme-preview.theme-steel {
    background: linear-gradient(135deg, #0f1419 0%, #1e2a36 100%);
}

.theme-preview.theme-sapphire {
    background: linear-gradient(135deg, #0a1128 0%, #18284d 100%);
}

.theme-preview .preview-sidebar {
    width: 30%;
    border-radius: 6px;
}

.theme-dark .preview-sidebar { background: var(--bg-tertiary); }
.theme-light .preview-sidebar { background: var(--bg-tertiary); }
.theme-ocean .preview-sidebar { background: #091520; }
.theme-emerald .preview-sidebar { background: #071510; }
.theme-purple .preview-sidebar { background: #0f0d15; }
.theme-steel .preview-sidebar { background: #0b1015; }
.theme-sapphire .preview-sidebar { background: #070c1c; }

.theme-preview .preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-preview .preview-header {
    height: 20px;
    border-radius: 4px;
}

.theme-dark .preview-header { background: var(--bg-tertiary); }
.theme-light .preview-header { background: var(--bg-tertiary); }
.theme-ocean .preview-header { background: #0891B2; }
.theme-emerald .preview-header { background: #059669; }
.theme-purple .preview-header { background: #7C3AED; }
.theme-steel .preview-header { background: #3B82F6; }
.theme-sapphire .preview-header { background: #2563EB; }

.theme-preview .preview-card {
    flex: 1;
    border-radius: 4px;
}

.theme-dark .preview-card { background: var(--bg-tertiary); }
.theme-light .preview-card { background: var(--bg-card); }
.theme-ocean .preview-card { background: rgba(8, 145, 178, 0.2); }
.theme-emerald .preview-card { background: rgba(5, 150, 105, 0.2); }
.theme-purple .preview-card { background: rgba(124, 58, 237, 0.2); }
.theme-steel .preview-card { background: rgba(59, 130, 246, 0.15); }
.theme-sapphire .preview-card { background: rgba(37, 99, 235, 0.2); }

.theme-label {
    padding: 12px;
    text-align: center;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.theme-option.selected .theme-label {
    background: var(--primary);
    color: #fff;
}

/* ============================================
   Font Size Selector
   ============================================ */
.font-size-selector {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.font-btn {
    flex: 1;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.font-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.font-btn.active {
    border-color: var(--primary);
    background: var(--primary);
}

.font-btn label {
    font-size: 0.8rem;
    color: inherit;
    cursor: pointer;
}

/* ============================================
   Maintenance Cards
   ============================================ */
.maintenance-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.maintenance-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.maintenance-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.maintenance-icon i {
    font-size: 1.25rem;
    color: var(--primary);
}

.maintenance-icon.warning {
    background: rgba(251, 191, 36, 0.15);
}

.maintenance-icon.warning i {
    color: #fbbf24;
}

.maintenance-info {
    flex: 1;
}

.maintenance-info h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-weight: 500;
}

.maintenance-info p {
    color: var(--text-secondary, rgba(255,255,255,0.5));
    font-size: 0.85rem;
    margin: 0;
}

/* ============================================
   System Info Grid
   ============================================ */
.system-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.info-item {
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.info-item label {
    display: block;
    color: var(--text-secondary, rgba(255,255,255,0.5));
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.info-item span {
    color: var(--text-primary);
    font-weight: 500;
}

/* ============================================
   Form Actions
   ============================================ */
.form-actions {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
}

/* ============================================
   Alert Styles
   ============================================ */
.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 14px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

/* ============================================
   Loading State
   ============================================ */
.settings-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
    color: var(--text-secondary, rgba(255,255,255,0.6));
}

.settings-loading i {
    font-size: 2rem;
    color: var(--primary);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .settings-nav {
        position: static;
    }
    
    .settings-nav-items {
        display: flex;
        overflow-x: auto;
        padding: 8px;
        gap: 8px;
    }
    
    .settings-nav-item {
        white-space: nowrap;
        padding: 10px 14px;
        margin: 0;
    }
    
    .settings-nav-item span {
        display: none;
    }
    
    .settings-nav-item i {
        margin: 0;
    }
    
    .settings-content {
        padding: 16px;
    }
    
    .theme-options {
        grid-template-columns: 1fr;
    }
    
    .maintenance-card {
        flex-direction: column;
        text-align: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* ============================================
   RTL Support
   ============================================ */
[dir="rtl"] .settings-container {
    direction: rtl;
}

[dir="rtl"] .settings-nav-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .toggle-slider:before {
    left: auto;
    right: 3px;
}

[dir="rtl"] .toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(-24px);
}

[dir="rtl"] .maintenance-card {
    flex-direction: row-reverse;
}

@media (max-width: 768px) {
    [dir="rtl"] .maintenance-card {
        flex-direction: column;
    }
}
