/* ============================================
   MODAL DE CONFIGURACIÓN INTEGRADO
   ============================================ */

/* Soporte para clases nuevas Y viejas (compatibilidad) */
.settings-modal,
#settingsModal.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.settings-modal.active,
#settingsModal.modal.active {
    display: block;
}

.settings-overlay,
#settingsModal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.settings-content,
#settingsModal .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-color, white);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.settings-header,
#settingsModal .modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card, #f5f5f5);
}

.settings-header h2,
#settingsModal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.settings-close,
#settingsModal .modal-close {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

.settings-close:hover,
#settingsModal .modal-close:hover {
    background: var(--hover-color, #e0e0e0);
    color: var(--text-primary, #333);
}

.settings-close svg,
#settingsModal .modal-close svg {
    width: 20px;
    height: 20px;
}

.settings-body,
#settingsModal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary, #666);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.setting-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle, #f0f0f0);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-label strong {
    font-weight: 500;
    color: var(--text-primary, #333);
    font-size: 0.95rem;
}

.setting-label span {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Color Preview Badge */
.color-preview-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
    transition: all 0.2s;
}

#previewLead {
    background: var(--status-lead, #f39c12);
}

#previewNoResponse {
    background: var(--status-contacted, #95a5a6);
}

#previewInProgress {
    background: var(--status-proposal, #e67e22);
}

#previewStalled {
    background: var(--status-negotiation, #e74c3c);
}

#previewCompleted {
    background: var(--status-closed, #00897b);
}

/* Color Input */
.color-input {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-input:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Settings Select */
.settings-select {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
}

.settings-select:hover {
    border-color: var(--primary-color);
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.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%;
}

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

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

/* Reset Colors Button */
.btn-reset-colors {
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-reset-colors:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

/* Settings Footer */
.settings-footer,
#settingsModal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, #e0e0e0);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-card, #f5f5f5);
}

.settings-footer button,
#settingsModal .modal-footer button {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-secondary,
#settingsModal .btn-secondary {
    background: var(--background-color, white);
    border: 1px solid var(--border-color, #e0e0e0);
    color: var(--text-primary, #333);
}

.btn-secondary:hover,
#settingsModal .btn-secondary:hover {
    background: var(--hover-color, #e0e0e0);
}

.btn-primary,
#settingsModal .btn-primary {
    background: var(--primary-color, #667eea);
    border: none;
    color: white;
}

.btn-primary:hover,
#settingsModal .btn-primary:hover {
    background: var(--primary-hover, #5568d3);
}

/* Dark mode adjustments */
.dark-mode .settings-content {
    background: var(--surface-color);
}

.dark-mode .settings-header,
.dark-mode .settings-footer {
    background: var(--bg-card);
}

.dark-mode .color-input {
    border-color: var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .settings-content {
        width: 95%;
        max-height: 95vh;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .setting-control {
        width: 100%;
        justify-content: space-between;
    }

    .color-preview-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
        min-width: 100px;
    }
}