/**
 * Nicole di Bella - Panel de Diseño Premium
 * Sistema de personalización en vivo para pruebas de diseño
 * NOTA: Solo disponible en versión Desktop
 */

/* ============================================
   PANEL DE DISEÑO - ESTRUCTURA PRINCIPAL
   ============================================ */

#theme-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 99999 !important;
    transition: right 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    overflow-y: auto;
}

#theme-panel.active {
    right: 0;
}

/* Botón Toggle */
.theme-panel-toggle {
    position: absolute;
    left: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 10px 0 0 10px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000 !important;
}

.theme-panel-toggle:hover {
    transform: translateY(-50%) scale(1.05);
}

/* Header del Panel */
.theme-panel-header {
    background: var(--gradient-primary);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.theme-panel-header h3 {
    font-family: 'League Sparta', serif;
    font-size: 24px;
    margin: 0 0 5px 0;
    font-weight: 700;
}

.theme-panel-header p {
    font-size: 12px;
    margin: 0;
    opacity: 0.9;
}

/* Contenido del Panel */
.theme-panel-content {
    padding: 20px;
}

/* Secciones */
.theme-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.theme-section:last-child {
    border-bottom: none;
}

.section-title {
    font-family: 'League Sparta', serif;
    font-size: 18px;
    font-weight: 700;
    color: #2D2D2D;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary-purple);
    font-size: 16px;
}

/* Subsecciones */
.subsection {
    margin-bottom: 20px;
    padding-left: 20px;
    border-left: 3px solid #f0f0f0;
}

.subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: #4A4A4A;
    margin-bottom: 12px;
}

/* Controles */
.control-group {
    margin-bottom: 12px;
}

.control-label {
    display: block;
    font-size: 12px;
    color: #6B6B6B;
    margin-bottom: 5px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Color Picker */
.color-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.color-picker {
    width: 40px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
}

.color-picker:hover {
    transform: scale(1.05);
    border-color: var(--primary-purple);
}

.color-picker input[type="color"] {
    width: 100%;
    height: 100%;
    border: none;
    cursor: pointer;
    opacity: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Force better color picker on mobile */
@media (max-width: 768px) {
    .color-picker {
        width: 60px;
        height: 60px;
    }
    
    .color-picker input[type="color"] {
        width: 200%;
        height: 200%;
        transform: translate(-25%, -25%);
    }
}

/* iOS specific color picker improvements */
@supports (-webkit-touch-callout: none) {
    .color-picker input[type="color"] {
        width: 100%;
        height: 100%;
    }
    
    .color-picker input[type="color"]::-webkit-color-swatch-wrapper {
        padding: 0;
    }
    
    .color-picker input[type="color"]::-webkit-color-swatch {
        border: none;
        border-radius: 8px;
    }
}

.color-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hex-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 12px;
    font-family: 'Monaco', monospace;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.hex-input:focus {
    outline: none;
    border-color: var(--primary-purple);
}

/* Mobile improvements for hex input */
@media (max-width: 768px) {
    .hex-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
        min-height: 44px; /* iOS touch target */
    }
    
    .control-row {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .color-input-wrapper {
        justify-content: center;
    }
}

/* Slider Range */
.range-slider {
    width: 100%;
    margin: 10px 0;
}

.range-slider input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    border-radius: 3px;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.range-value {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-size: 12px;
    color: #6B6B6B;
    margin-left: 10px;
}

/* Select Dropdown */
.font-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.font-select:focus {
    outline: none;
    border-color: var(--primary-purple);
}

/* Temas Predefinidos */
.predefined-themes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.theme-preset {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.theme-preset:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-purple);
}

.theme-preset.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.theme-preset-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.theme-preset-name {
    font-size: 12px;
    font-weight: 600;
}

/* Botones de Acción */
.panel-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 10px;
}

.panel-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.panel-btn-secondary {
    background: #f0f0f0;
    color: #4A4A4A;
}

.panel-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* Gradiente Controls */
.gradient-control {
    margin-bottom: 15px;
}

.gradient-colors {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.gradient-preview {
    height: 40px;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid #e0e0e0;
}

/* Force visibility over all elements */
#theme-panel,
.theme-panel-toggle {
    z-index: 999999 !important;
    position: fixed !important;
}

.theme-panel-toggle {
    right: 0 !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: linear-gradient(135deg, #FFB6D5 0%, #F4C2C2 100%) !important;
}

/* Responsive */
@media (max-width: 768px) {
    #theme-panel {
        width: 100%;
        right: -100%;
    }
    
    .theme-panel-toggle {
        right: 0 !important;
        left: auto !important;
        width: 60px;
        height: 60px;
        font-size: 20px;
        top: 20px !important;
        transform: none !important;
    }
    
    .theme-panel-content {
        padding: 15px;
    }
    
    .theme-section {
        margin-bottom: 25px;
        padding-bottom: 20px;
    }
    
    .section-title {
        font-size: 20px;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .subsection-title {
        font-size: 16px;
        margin-bottom: 15px;
        text-align: center;
    }
    
    .control-group {
        margin-bottom: 20px;
    }
    
    .control-label {
        font-size: 14px;
        margin-bottom: 10px;
        text-align: center;
        font-weight: 600;
    }
    
    /* Better touch targets */
    .theme-preset {
        padding: 20px;
        margin: 5px;
        min-height: 80px;
    }
    
    .theme-preset-icon {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .theme-preset-name {
        font-size: 14px;
    }
    
    /* Panel buttons */
    .panel-btn {
        padding: 15px 20px;
        font-size: 16px;
        min-height: 50px;
    }
    
    /* Color palette for mobile */
    .color-palette {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
        margin: 10px 0;
        padding: 10px;
        background: #f9f9f9;
        border-radius: 8px;
    }
    
    .color-palette-item {
        width: 40px;
        height: 40px;
        border-radius: 6px;
        border: 2px solid #e0e0e0;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .color-palette-item:hover,
    .color-palette-item.selected {
        border-color: var(--primary-purple);
        transform: scale(1.1);
    }
}

@media (max-width: 480px) {
    .theme-panel-toggle {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.theme-section {
    animation: slideIn 0.3s ease backwards;
}

.theme-section:nth-child(1) { animation-delay: 0.1s; }
.theme-section:nth-child(2) { animation-delay: 0.2s; }
.theme-section:nth-child(3) { animation-delay: 0.3s; }
.theme-section:nth-child(4) { animation-delay: 0.4s; }

/* Tooltips */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Loading State */
.panel-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE - OCULTAR EN MÓVIL
   ============================================ */

/* Ocultar panel de diseño en dispositivos móviles */
@media (max-width: 991px) {
    #theme-panel,
    .theme-panel-toggle {
        display: none !important;
    }
}