/* ================================================== */
/* STYLES.CSS - Dashboard Personalizado v1.0.9 */
/* Última modificación: Mejoras de variables y accesibilidad */
/* ================================================== */

/* VARIABLES CSS */
:root {
    --primary-color: #3366cc;
    --primary-hover: #254eaf;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
    --text-light: white;
    --text-dark: #333;
    --bg-blur: rgba(255, 255, 255, 0.1);
    --border-radius: 10px;
    --transition: all 0.3s ease;
}

/* RESET Y CONFIGURACIÓN BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--text-light);
    min-height: 100vh;
    padding: 0;
}

/* TOPBAR FIJA */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-blur);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.datetime-widget {
    text-align: left;
}

.time {
    font-size: 1.8rem;
    font-weight: 300;
}

.date {
    font-size: 1rem;
    opacity: 0.8;
}

.weather-widget {
    background: var(--bg-blur);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.weather-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.weather-temp {
    font-size: 1.4rem;
    font-weight: 600;
}

.weather-desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

.weather-location {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* CONTENEDOR PRINCIPAL CON 80% DE ANCHO */
.container {
    width: 80%;
    max-width: 1600px;
    margin: 120px auto 0 auto;
    padding: 0 20px;
}

/* BARRA DE BÚSQUEDA */
.search-container {
    display: flex;
    justify-content: center;
    margin: 40px 0 50px 0;
}

.search-box {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50px;
    padding: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 800px;
}

#searchEngine {
    border: none;
    background: transparent;
    padding: 0 15px;
    border-radius: 25px 0 0 25px;
    outline: none;
    color: var(--text-dark);
    min-width: 120px;
}

#searchInput {
    flex: 1;
    border: none;
    padding: 15px;
    font-size: 1.1rem;
    outline: none;
    background: transparent;
    color: var(--text-dark);
}

#searchBtn {
    background: var(--primary-color);
    border: none;
    color: var(--text-light);
    padding: 15px 25px;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
    min-width: 80px;
}

#searchBtn:hover {
    background: var(--primary-hover);
}

/* 8 COLUMNAS PARA ACCESOS DIRECTOS - OCUPANDO TODO EL ANCHO */
.shortcuts-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    max-height: 65vh;
    overflow-y: auto;
    padding: 20px 0;
    width: 100%;
}

/* MEJORAS EN ACCESOS DIRECTOS */
.shortcut-item {
    cursor: default !important;
    will-change: transform, opacity; /* Mejora de performance */
}

/* ⚠️ ELIMINADAS LAS REGLAS DE CURSOR CON URL SVG - CAUSAN CONFLICTOS */
/* Los cursores ahora se manejan en custom-fixes.css */

/* BOTÓN AÑADIR */
.shortcut-item.add-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    font-size: 2rem;
    cursor: pointer;
}

.shortcut-item.add-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.shortcut-icon {
    width: 35px;
    height: 35px;
    margin-bottom: 8px;
    border-radius: 6px;
}

.shortcut-name {
    font-size: 0.8rem;
    word-break: break-word;
    max-width: 100%;
    color: var(--text-light);
}

/* BOTÓN CONFIGURACIÓN */
.settings-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    color: var(--text-light);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

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

.modal-content {
    background: var(--text-light);
    color: var(--text-dark);
    padding: 30px;
    border-radius: 20px;
    min-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-content input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    color: var(--text-dark);
}

.modal-content input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

#saveShortcut {
    background: var(--primary-color);
    color: var(--text-light);
}

#saveShortcut:hover {
    background: var(--primary-hover);
}

#cancelShortcut {
    background: #f0f0f0;
    color: #666;
}

#cancelShortcut:hover {
    background: #e0e0e0;
}

/* SCROLLBAR PERSONALIZADO */
.shortcuts-container::-webkit-scrollbar {
    width: 8px;
}

.shortcuts-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.shortcuts-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.shortcuts-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== SISTEMA DE DRAG & DROP - CURSORES MANEJADOS POR custom-fixes.css ===== */

/* Estados visuales del drag & drop */
.shortcut-item.dragging {
    opacity: 0.6;
    transform: scale(0.95);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.shortcut-item.drag-over {
    border: 2px dashed var(--primary-color);
    background: rgba(51, 102, 204, 0.1);
}

.shortcuts-container.drag-over {
    background: rgba(51, 102, 204, 0.05);
    border-radius: 12px;
}

.shortcut-item.drag-ghost {
    opacity: 0.7;
    transform: rotate(5deg);
}

.shortcut-item.add-btn.drag-over {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

/* Elementos bloqueados */
.shortcut-item.locked {
    cursor: not-allowed;
    opacity: 0.7;
}

.shortcut-item.locked:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
}

/* MODAL DE CONFIGURACIÓN */
.config-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.config-content {
    background: var(--text-light);
    color: var(--text-dark);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.config-header {
    background: linear-gradient(135deg, var(--primary-color), var(--gradient-end));
    color: var(--text-light);
    padding: 25px 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-config {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-config:hover {
    background: rgba(255, 255, 255, 0.2);
}

.config-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0 30px;
}

.config-tab {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.config-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--text-light);
}

.config-tab:hover {
    color: var(--primary-hover);
    background: rgba(51, 102, 204, 0.1);
}

.config-body {
    padding: 30px;
}

.config-section {
    margin-bottom: 30px;
    display: none;
}

.config-section.active {
    display: block;
}

.config-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 1.3rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

/* FORMULARIOS DE CONFIGURACIÓN */
.config-group {
    margin-bottom: 20px;
}

.config-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.config-select, .config-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.config-select:focus, .config-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.config-group small {
    color: #666;
    font-size: 0.8rem;
    display: block;
    margin-top: 5px;
}

/* SELECTOR DE COLORES */
.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

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

.color-option.selected {
    border-color: var(--text-dark);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* GRADIENTES PREDEFINIDOS */
.gradient-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.gradient-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.gradient-option:hover {
    transform: scale(1.05);
}

.gradient-option.selected {
    border-color: var(--text-dark);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* SUBIDA DE IMÁGENES */
.upload-area {
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e8f0fe;
}

.upload-icon {
    font-size: 3rem;
    color: #666;
    margin-bottom: 15px;
}

.upload-text {
    color: #666;
    margin-bottom: 10px;
}

.upload-btn {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--primary-hover);
}

/* IMÁGENES PREDETERMINADAS */
.default-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.default-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    object-fit: cover;
}

.default-image:hover {
    transform: scale(1.05);
}

.default-image.selected {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* CONFIGURACIÓN DE UBICACIÓN */
.location-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.location-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.location-option:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.location-option.selected {
    border-color: var(--primary-color);
    background: #e8f0fe;
}

.location-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

/* MEJORAS PARA LA CONFIGURACIÓN DE UBICACIÓN */
.location-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--text-light);
}

.location-option:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.location-option.selected {
    border-color: var(--primary-color);
    background: #e8f0fe;
    box-shadow: 0 2px 8px rgba(51, 102, 204, 0.2);
}

.location-option input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
}

.location-option label {
    margin: 0;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
}

.manual-location-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-top: 15px;
}

/* BOTONES DE CONFIGURACIÓN */
.config-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.config-btn {
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
}

.config-btn.primary {
    background: var(--primary-color);
    color: var(--text-light);
}

.config-btn.primary:hover {
    background: var(--primary-hover);
}

.config-btn.secondary {
    background: #6c757d;
    color: var(--text-light);
}

.config-btn.secondary:hover {
    background: #545b62;
}

/* PREVIEW EN TIEMPO REAL */
.background-preview {
    width: 100%;
    height: 120px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    border: 2px solid #e9ecef;
    overflow: hidden;
}

/* SWITCH TOGGLE */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

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

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ESTILOS PARA EL SISTEMA DE FONDOS */
.gradient-options, .color-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.gradient-option, .color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}

.gradient-option:hover, .color-option:hover {
    transform: scale(1.05);
}

.gradient-option.selected, .color-option.selected {
    border-color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.default-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.default-image {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
    object-fit: cover;
}

.default-image:hover {
    transform: scale(1.02);
}

.default-image.selected {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(51, 102, 204, 0.4);
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e8f0fe;
}

.upload-icon {
    font-size: 2.5rem;
    color: #666;
    margin-bottom: 10px;
}

.upload-text {
    color: #666;
    margin-bottom: 10px;
}

.upload-btn {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--primary-hover);
}

.background-preview {
    width: 100%;
    height: 120px;
    border-radius: var(--border-radius);
    margin-top: 10px;
    border: 2px solid #e9ecef;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    overflow: hidden;
}

/* RADIO BUTTONS PERSONALIZADOS */
.location-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.location-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--text-light);
}

.location-option:hover {
    border-color: var(--primary-color);
    background: #f8f9ff;
}

.location-option.selected {
    border-color: var(--primary-color);
    background: #e8f0fe;
    box-shadow: 0 2px 8px rgba(51, 102, 204, 0.2);
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
}

.location-option.selected .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.location-option.selected .radio-custom::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
}

.manual-location-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-top: 10px;
}

/* CHECKBOXES PERSONALIZADOS */
.config-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* MEJORAS DE ACCESIBILIDAD */
button:focus-visible, 
input:focus-visible,
select:focus-visible,
.config-tab:focus-visible,
.close-config:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* RESPONSIVE - MANTENER 8 COLUMNAS EN PANTALLAS GRANDES */
@media (min-width: 1600px) {
    .container {
        width: 85%;
    }
    
    .shortcuts-container {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 1599px) {
    .shortcuts-container {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 1400px) {
    .shortcuts-container {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (max-width: 1200px) {
    .shortcuts-container {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 992px) {
    .shortcuts-container {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .container {
        width: 90%;
    }
}

@media (max-width: 768px) {
    .shortcuts-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .container {
        width: 95%;
    }
    
    .topbar {
        padding: 10px 15px;
    }
    
    .time {
        font-size: 1.4rem;
    }
    
    .weather-info {
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .shortcuts-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .search-box {
        flex-direction: column;
        border-radius: 20px;
    }
    
    #searchEngine {
        border-radius: 20px 20px 0 0;
        padding: 10px;
    }
    
    #searchInput {
        border-radius: 0;
    }
    
    #searchBtn {
        border-radius: 0 0 20px 20px;
    }
}

@media (max-width: 480px) {
    .shortcuts-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        width: 98%;
    }
}