/**
 * Settings Module CSS Styles
 * Comprehensive settings interface with tabbed navigation
 */

/* Settings-specific variables */
:root {
    --settings-accent: #2563eb;
    --settings-accent-light: #3b82f6;
    --settings-accent-lighter: #60a5fa;
    --settings-success: #16a34a;
    --settings-warning: #d97706;
    --settings-danger: #dc2626;
    --settings-section-bg: rgba(255, 255, 255, 0.8);
    --settings-border: rgba(37, 99, 235, 0.2);
    --toggle-bg: #e5e7eb;
    --toggle-active: var(--settings-accent);
}

/* Dark mode adjustments */
body.dark-mode {
    --settings-section-bg: rgba(30, 41, 59, 0.8);
    --settings-border: rgba(59, 130, 246, 0.3);
    --toggle-bg: #374151;
}

/* Main container */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-gradient);
    min-height: 100vh;
}

/* Settings Navigation */
.settings-navigation {
    margin-bottom: 2rem;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: var(--settings-section-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--settings-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--settings-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.tab-button:hover {
    background: var(--settings-accent-lighter);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tab-button.active {
    background: var(--settings-accent);
    color: white;
    border-color: var(--settings-accent);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

/* Settings Container */
.settings-container {
    background: var(--settings-section-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--settings-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

/* Settings Tab Content */
.settings-tab {
    display: none;
    padding: 2rem;
}

.settings-tab.active {
    display: block;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Headers */
.section-header {
    margin-bottom: 2rem;
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--settings-border);
}

.section-header h2 {
    color: var(--settings-accent);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    gap: 1.5rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px solid var(--settings-border);
    transition: all 0.3s ease;
}

.setting-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--settings-accent-light);
}

.setting-info {
    flex: 1;
    margin-right: 2rem;
}

.setting-info h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.setting-info p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.setting-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Toggle Switches */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
}

.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: var(--toggle-bg);
    transition: 0.4s;
    border-radius: 32px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

input:checked + .toggle-slider {
    background-color: var(--toggle-active);
}

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

/* Form Controls */
.form-select, .form-input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--settings-border);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 200px;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--settings-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Sliders */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--toggle-bg);
    outline: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--settings-accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.slider-value {
    font-weight: 600;
    color: var(--settings-accent);
    min-width: 50px;
    text-align: right;
}

/* Color Themes */
.color-themes {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
}

.color-preview {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.color-option.blue .color-preview { background: #2563eb; }
.color-option.green .color-preview { background: #16a34a; }
.color-option.purple .color-preview { background: #9333ea; }
.color-option.orange .color-preview { background: #ea580c; }
.color-option.red .color-preview { background: #dc2626; }

/* Account Info Card */
.account-info-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 1px solid var(--settings-border);
    margin-bottom: 2rem;
}

.account-avatar {
    text-align: center;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--settings-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.account-details {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-field label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.account-field span {
    color: var(--text-primary);
    font-size: 1rem;
}

/* Data Management Grid */
.data-management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.data-section {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px solid var(--settings-border);
}

.data-section h3 {
    color: var(--settings-accent);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.data-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Export Options */
.export-options {
    margin-bottom: 1.5rem;
}

.export-item {
    margin-bottom: 0.75rem;
}

/* Import Area */
.import-area {
    text-align: center;
}

.import-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    display: none;
}

.import-status.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--settings-success);
    display: block;
}

.import-status.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--settings-danger);
    display: block;
}

/* Storage Info */
.storage-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.storage-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--settings-border);
}

.storage-total {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-top: 2px solid var(--settings-accent);
    margin-top: 0.5rem;
}

/* Danger Section */
.danger-section {
    border-color: var(--settings-danger);
    background: rgba(220, 38, 38, 0.05);
}

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

/* Settings Actions */
.settings-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--settings-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--settings-accent-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--settings-success);
    color: white;
}

.btn-success:hover {
    background: #15803d;
    transform: translateY(-2px);
}

.btn-warning {
    background: var(--settings-warning);
    color: white;
}

.btn-warning:hover {
    background: #c2410c;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--settings-danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Checkbox Labels */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-left: 2rem;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--toggle-bg);
    border-radius: 4px;
    transition: all 0.3s ease;
    border: 2px solid var(--settings-border);
}

.checkbox-label:hover .checkmark {
    background-color: var(--settings-accent-lighter);
}

.checkbox-label input:checked ~ .checkmark {
    background-color: var(--settings-accent);
    border-color: var(--settings-accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--settings-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--settings-accent);
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--settings-danger);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--settings-border);
}

/* Form Groups in Modals */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--settings-border);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--settings-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Password Strength */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-fill.weak {
    background: var(--settings-danger);
    width: 25%;
}

.strength-fill.fair {
    background: var(--settings-warning);
    width: 50%;
}

.strength-fill.good {
    background: #3b82f6;
    width: 75%;
}

.strength-fill.strong {
    background: var(--settings-success);
    width: 100%;
}

#strengthText {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}

.avatar-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    background: rgba(37, 99, 235, 0.1);
}

.avatar-option:hover {
    transform: scale(1.1);
    background: rgba(37, 99, 235, 0.2);
}

.avatar-option.selected {
    border-color: var(--settings-accent);
    background: rgba(37, 99, 235, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        padding: 1.5rem;
    }
    
    .settings-tabs {
        padding: 0.75rem;
    }
    
    .tab-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .settings-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: unset;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .setting-info {
        margin-right: 0;
    }
    
    .account-info-card {
        flex-direction: column;
        text-align: center;
    }
    
    .account-details {
        grid-template-columns: 1fr;
    }
    
    .data-management-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-actions {
        flex-direction: column;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .settings-tab {
        padding: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .setting-item {
        padding: 1rem;
    }
    
    .slider-container {
        min-width: 150px;
    }
    
    .form-select, .form-input {
        min-width: 150px;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .avatar-option {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Dark mode specific adjustments */
body.dark-mode .modal-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

body.dark-mode .form-select,
body.dark-mode .form-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--settings-border);
}

body.dark-mode .setting-item {
    background: rgba(30, 41, 59, 0.5);
}

body.dark-mode .account-info-card {
    background: rgba(30, 41, 59, 0.6);
}

body.dark-mode .data-section {
    background: rgba(30, 41, 59, 0.5);
}

/* Animations for improved UX */
.setting-item {
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.settings-actions .btn {
    animation: bounceIn 0.5s ease;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80% {
        animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
        opacity: 0;
        transform: scale3d(.3, .3, .3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(.9, .9, .9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(.97, .97, .97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}
