

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.settings-modal.show {
    display: flex;
}

.settings-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.settings-modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
    z-index: 10001;
    display: flex;
    flex-direction: column;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.settings-modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.settings-close-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    flex-wrap: wrap;
}

.settings-tab {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.settings-tab.active {
    color: var(--mth-primary);
    border-bottom-color: var(--mth-primary);
    background: var(--bg-primary);
}

.settings-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.settings-tab-pane {
    display: none;
}

.settings-tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

/* Typography Styles */
.font-selector {
    margin-bottom: 1.5rem;
}

.font-dropdown {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.font-dropdown:focus {
    border-color: var(--mth-primary);
    outline: none;
}

.font-preview {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

#font-preview-text {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.5;
}

.color-picker-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-picker-item label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.color-picker-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 40px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.color-reset-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.color-reset-btn:hover {
    background: var(--mth-primary);
    color: white;
    border-color: var(--mth-primary);
}

.color-preview {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

.preview-heading h4 {
    margin: 0 0 0.5rem 0;
    color: var(--mth-heading-color);
}

.preview-paragraph p {
    margin: 0;
    color: var(--mth-paragraph-color);
    line-height: 1.5;
}

/* Theme Mode Options */
.theme-mode-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Color Presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.color-preset {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.color-preset:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.color-preset.active {
    border-color: var(--text-primary);
}

.color-preset i {
    color: white;
    font-size: 1rem;
    opacity: 0;
    transition: var(--transition);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.color-preset.active i {
    opacity: 1;
}

/* Custom Color Picker */
.custom-color-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.custom-color-picker label {
    color: var(--text-primary);
    font-weight: 500;
}

.custom-color-picker input[type="color"] {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    background: none;
}

.custom-color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-color-picker input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Font Size Controls */
.font-size-control {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}

.font-size-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.font-size-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--mth-primary);
}

.font-size-btn.active {
    background: var(--mth-primary);
    color: white;
    border-color: var(--mth-primary);
}

.font-size-preview {
    font-weight: bold;
}

.font-size-btn[data-size="small"] .font-size-preview { font-size: 0.875rem; }
.font-size-btn[data-size="medium"] .font-size-preview { font-size: 1rem; }
.font-size-btn[data-size="large"] .font-size-preview { font-size: 1.125rem; }

.font-size-label {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Toggle Switches */
.toggle-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.toggle-option:last-child {
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.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(--gray-400);
    transition: var(--transition);
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
    background-color: var(--mth-primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-label {
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    margin-right: 1rem;
}

/* Radio Options */
.radio-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    padding: 0.5rem 0;
}

.radio-option input {
    display: none;
}

.radio-checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
}

.radio-option input:checked + .radio-checkmark {
    border-color: var(--mth-primary);
}

.radio-option input:checked + .radio-checkmark::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--mth-primary);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radio-label {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--mth-primary);
    color: var(--mth-primary);
}

.btn-primary {
    background: var(--mth-primary);
    color: white;
    border: 2px solid var(--mth-primary);
}

.btn-primary:hover {
    background: var(--mth-secondary);
    border-color: var(--mth-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: 2px solid var(--secondary);
}

.btn-warning {
    background: var(--warning);
    color: var(--dark);
    border: 2px solid var(--warning);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: 2px solid var(--danger);
}

.btn-full {
    width: 100%;
}

/* Modal Footer */
.settings-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Loading Spinner */
.settings-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    flex-direction: column;
    color: white;
}

.settings-loading.show {
    display: flex;
}

.loading-spinner {
    color: white;
    font-size: 3rem;
    text-align: center;
}

.loading-spinner p {
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Success Toast */
.settings-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 10003;
    display: none;
    animation: slideInRight 0.3s ease;
}

.settings-toast.show {
    display: block;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* New Badge */
.new-badge {
    background: var(--mth-secondary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    animation: pulse 2s infinite;
}

/* About Info */
.about-info {
    color: var(--text-secondary);
    line-height: 1.5;
}

.about-info .version {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
    }
    
    .settings-tab {
        flex: 1;
        min-width: 120px;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .color-presets {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .font-size-control {
        grid-template-columns: 1fr;
    }
    
    .footer-actions {
        flex-direction: column;
    }
    
    .footer-actions .btn {
        width: 100%;
    }

    .color-picker-group {
        grid-template-columns: 1fr;
    }
}

/* High Contrast Mode */
.high-contrast {
    --mth-primary: #000000;
    --mth-secondary: #ffffff;
    --mth-text: #000000;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --text-primary: #000000;
    --border-color: #000000;
}

.high-contrast[data-theme="dark"] {
    --mth-primary: #ffffff;
    --mth-secondary: #000000;
    --mth-text: #ffffff;
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --border-color: #ffffff;
}
