/**
 * Account Settings Modal Styles
 *
 * Professional styling for the comprehensive account settings interface
 */

/* ========================================
   MODAL OVERLAY & CONTAINER
   ======================================== */

.account-settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 20000; /* Higher than dependency popup (10000) */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.account-settings-content {
    background: #ffffff;
    border-radius: 10px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   HEADER
   ======================================== */

.account-settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.account-settings-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.account-settings-header .modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.account-settings-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   TAB NAVIGATION
   ======================================== */

.account-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0;
}

.account-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.account-tab:hover {
    background: rgba(102, 126, 234, 0.05);
    color: #495057;
}

.account-tab.active {
    color: #667eea;
    background: white;
    border-bottom-color: #667eea;
}

.account-tab .tab-icon {
    font-size: 12px;
}

/* ========================================
   TAB CONTENT
   ======================================== */

.account-tabs-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.account-tab-pane {
    display: none;
}

.account-tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ========================================
   SETTINGS SECTIONS
   ======================================== */

.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: #212529;
}

.section-description {
    margin: 0 0 12px 0;
    font-size: 11px;
    color: #6c757d;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #495057;
}

/* Password Input Group with Toggle Button */
.password-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    overflow: hidden;
    background: white;
}

.password-input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.password-input-group .form-input {
    flex: 1;
    border: none;
    padding: 6px 10px;
    border-radius: 0;
    font-size: 12px;
    color: #212529;
    background: transparent;
    transition: none;
}

.password-input-group .form-input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}

.password-toggle {
    background: transparent;
    border: none;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    border-left: 1px solid #dee2e6;
}

.password-toggle:hover {
    color: #495057;
    background: #f8f9fa;
}

.password-toggle:active {
    background: #e9ecef;
}

.password-toggle.visible {
    color: #667eea;
}

.form-input,
.form-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    color: #212529;
    background: white;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-input:read-only {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: #6c757d;
    font-style: italic;
}

/* ========================================
   BUTTONS
   ======================================== */

.form-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* ========================================
   PASSWORD STRENGTH INDICATOR
   ======================================== */

.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.strength-fill.strength-weak {
    background: linear-gradient(90deg, #dc3545 0%, #e74c3c 100%);
}

.strength-fill.strength-fair {
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
}

.strength-fill.strength-good {
    background: linear-gradient(90deg, #17a2b8 0%, #0dcaf0 100%);
}

.strength-fill.strength-strong {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.strength-text {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
}

/* ========================================
   PASSWORD REQUIREMENTS
   ======================================== */

.password-requirements {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
}

.password-requirements h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.password-requirements ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.password-requirements li {
    padding: 6px 0;
    font-size: 13px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-requirements li.met {
    color: #28a745;
    font-weight: 500;
}

/* ========================================
   NOTIFICATION PREFERENCES
   ======================================== */

.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.preference-item:hover {
    background: #e9ecef;
}

.preference-info strong {
    display: block;
    font-size: 14px;
    color: #212529;
    margin-bottom: 4px;
}

.preference-info p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
}

/* ========================================
   TOGGLE SWITCHES (matching enhanced dropdown)
   ======================================== */

.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: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    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: #28a745;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* ========================================
   SUCCESS MESSAGE
   ======================================== */

.account-success-message {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    z-index: 10001;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.account-tabs-content::-webkit-scrollbar {
    width: 8px;
}

.account-tabs-content::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.account-tabs-content::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 4px;
}

.account-tabs-content::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .account-settings-content {
        width: 95%;
        max-height: 90vh;
    }

    .account-tab {
        padding: 12px 8px;
        font-size: 13px;
    }

    .account-tab .tab-icon {
        font-size: 16px;
    }

    .account-tab span:last-child {
        display: none;
    }

    .account-tabs-content {
        padding: 16px;
    }

    .preference-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toggle-switch {
        align-self: flex-end;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .account-settings-modal,
    .account-settings-content,
    .account-tab-pane,
    .account-success-message {
        animation: none;
    }

    .btn,
    .form-input,
    .form-select,
    .toggle-slider,
    .toggle-slider:before,
    .strength-fill {
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.account-tab:focus-visible,
.btn:focus-visible,
.form-input:focus-visible,
.form-select:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.toggle-switch input:focus-visible + .toggle-slider {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* ========================================
   DEFAULT COLUMNS GRID STYLING
   ======================================== */

#columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #f9fafc 100%);
    border-radius: 8px;
    border: 1px solid #e0e7ff;
}

.column-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #ffffff;
    border: 2px solid #e0e7ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.column-checkbox-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

/* Modern Checkbox Styling */
.column-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
    border-radius: 4px;
    flex-shrink: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    transition: all 0.2s ease;
}

.column-checkbox-item input[type="checkbox"]:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.column-checkbox-item input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    border-color: #667eea;
    box-shadow: inset 0 0 0 3px #ffffff;
}

.column-checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.column-checkbox-item input[type="checkbox"]:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Checkbox Label Styling */
.column-checkbox-item .checkbox-label {
    font-weight: 500;
    color: #2d3748;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.column-checkbox-item:hover .checkbox-label {
    color: #667eea;
}

/* Messages for Default Columns Tab */
.account-message {
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 6px;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid transparent;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-message.hidden {
    display: none;
}

.account-message.success {
    background: #d1fae5;
    color: #065f46;
    border-left-color: #10b981;
}

.account-message.error {
    background: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.account-message.info {
    background: #dbeafe;
    color: #0c2d6b;
    border-left-color: #3b82f6;
}
