/* =============================================================================
   TAILWIND CSS CDN + ESTILOS MODERNOS PARA EL VISUALIZADOR 3D
   ============================================================================= */

@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

/* =============================================================================
   ESTILOS BASE MODERNOS
   ============================================================================= */

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #e2e8f0;
    overflow: hidden;
    min-height: 100vh;
}

/* =============================================================================
   LAYOUT PRINCIPAL
   ============================================================================= */

.app-container {
    display: flex;
    height: 100vh;
    position: relative;
}

/* =============================================================================
   SIDEBAR MODERNO
   ============================================================================= */

.modern-sidebar {
    width: 380px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    padding: 0;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.modern-sidebar::-webkit-scrollbar {
    width: 6px;
}

.modern-sidebar::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.3);
}

.modern-sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 3px;
}

.modern-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

/* =============================================================================
   HEADER DEL SIDEBAR
   ============================================================================= */

.sidebar-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    padding: 24px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sidebar-title {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
    font-weight: 400;
}

/* =============================================================================
   SECCIONES MODERNAS
   ============================================================================= */

.modern-section {
    margin: 16px 20px;
    background: rgba(51, 65, 85, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.modern-section:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.section-header {
    background: linear-gradient(90deg, #475569 0%, #64748b 100%);
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-content {
    padding: 20px;
}

/* =============================================================================
   CONTROLES MODERNOS
   ============================================================================= */

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================================================
   INPUTS MODERNOS
   ============================================================================= */

.modern-select, .modern-range {
    width: 100%;
    padding: 10px 12px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.modern-select:focus, .modern-range:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(30, 41, 59, 0.9);
}

.modern-select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* =============================================================================
   BOTONES MODERNOS
   ============================================================================= */

.modern-button {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    margin: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.modern-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.modern-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.modern-button.secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.modern-button.secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.modern-button.small {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
    margin: 2px;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.modern-button.small:hover {
    background: linear-gradient(135deg, #ee5a24 0%, #d63031 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

/* =============================================================================
   VALORES DISPLAY
   ============================================================================= */

.value-display {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    text-align: center;
}

/* =============================================================================
   CONTROLES DE TRANSFORMACIÓN
   ============================================================================= */

.transform-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.transform-item {
    text-align: center;
}

.transform-item input {
    width: 100%;
    padding: 8px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.transform-item input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.axis-label {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================================================
   CONTROLES DE AUTO-ROTACIÓN
   ============================================================================= */

.auto-rotation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.auto-rot-item {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.auto-rot-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(59, 130, 246, 0.3);
}

.auto-rot-item label {
    display: block;
    font-size: 11px;
    color: #cbd5e1;
    margin-bottom: 6px;
    font-weight: 500;
}

.auto-rot-item input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
    accent-color: #3b82f6;
}

.auto-rot-item input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 10px;
    text-align: center;
    margin-top: 4px;
}

.auto-rot-item input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* =============================================================================
   COLOR PICKERS
   ============================================================================= */

.color-picker {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker:hover {
    border-color: #3b82f6;
    transform: scale(1.02);
}

.color-picker:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =============================================================================
   CHECKBOXES MODERNOS
   ============================================================================= */

.modern-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modern-checkbox:hover {
    color: #3b82f6;
}

.modern-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    transform: scale(1.1);
}

.modern-checkbox label {
    font-size: 13px;
    color: #cbd5e1;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

/* =============================================================================
   ESTADO Y LOG
   ============================================================================= */

.status-section {
    margin: 16px 20px;
    background: rgba(51, 65, 85, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.status-header {
    background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
    padding: 12px 20px;
}

.status-title {
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-content {
    padding: 16px 20px;
}

.status-text {
    font-size: 12px;
    color: #cbd5e1;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.modern-log {
    background: rgba(0, 0, 0, 0.8);
    color: #10b981;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 10px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.modern-log::-webkit-scrollbar {
    width: 4px;
}

.modern-log::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.modern-log::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.5);
    border-radius: 2px;
}

/* =============================================================================
   CONTENIDO PRINCIPAL
   ============================================================================= */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#canvas {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: none;
}

/* =============================================================================
   BOTÓN TOGGLE (MÓVIL Y DESKTOP)
   ============================================================================= */

.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.desktop-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.desktop-toggle:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.5);
}

.desktop-toggle:active {
    transform: translateY(0);
}

.mobile-toggle:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.5);
}

.mobile-toggle:active {
    transform: translateY(0);
}

/* =============================================================================
   OVERLAY MÓVIL
   ============================================================================= */

.mobile-overlay {
    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: 999;
    transition: all 0.3s ease;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 1024px) {
    .modern-sidebar {
        width: 340px;
    }
    
    .section-content {
        padding: 16px;
    }
    
    .transform-grid {
        gap: 6px;
    }
    
    .auto-rotation-grid {
        gap: 6px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .modern-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .modern-sidebar.active {
        left: 0;
        transform: translateX(0);
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .main-content {
        width: 100%;
        height: 100vh;
    }
    
    /* Ajustes para móviles */
    .sidebar-header {
        padding: 20px 16px;
    }
    
    .sidebar-title {
        font-size: 20px;
    }
    
    .modern-section {
        margin: 12px 16px;
    }
    
    .section-content {
        padding: 16px;
    }
    
    .section-title {
        font-size: 13px;
    }
    
    .control-label {
        font-size: 11px;
    }
    
    .modern-select, .modern-range {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .modern-button {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .transform-grid {
        gap: 4px;
    }
    
    .transform-item input {
        padding: 6px;
        font-size: 11px;
    }
    
    .axis-label {
        font-size: 9px;
    }
    
    .auto-rotation-grid {
        gap: 4px;
    }
    
    .auto-rot-item {
        padding: 8px;
    }
    
    .auto-rot-item label {
        font-size: 10px;
    }
    
    .auto-rot-item input[type="number"] {
        width: 50px;
        font-size: 9px;
    }
    
    .color-picker {
        height: 35px;
    }
    
    .modern-checkbox label {
        font-size: 12px;
    }
    
    .status-text {
        font-size: 11px;
    }
    
    .modern-log {
        font-size: 9px;
        max-height: 100px;
    }
}

@media (max-width: 480px) {
    .modern-sidebar {
        width: 95%;
        max-width: none;
    }
    
    .mobile-toggle {
        top: 12px;
        left: 12px;
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .sidebar-header {
        padding: 16px 12px;
    }
    
    .sidebar-title {
        font-size: 18px;
    }
    
    .modern-section {
        margin: 8px 12px;
    }
    
    .section-content {
        padding: 12px;
    }
    
    .section-title {
        font-size: 12px;
    }
    
    .control-label {
        font-size: 10px;
    }
    
    .modern-select, .modern-range {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .modern-button {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .transform-grid {
        gap: 3px;
    }
    
    .transform-item input {
        padding: 4px;
        font-size: 10px;
    }
    
    .axis-label {
        font-size: 8px;
    }
    
    .auto-rotation-grid {
        gap: 3px;
    }
    
    .auto-rot-item {
        padding: 6px;
    }
    
    .auto-rot-item label {
        font-size: 9px;
    }
    
    .auto-rot-item input[type="number"] {
        width: 45px;
        font-size: 8px;
    }
    
    .color-picker {
        height: 30px;
    }
    
    .modern-checkbox label {
        font-size: 11px;
    }
    
    .status-text {
        font-size: 10px;
    }
    
    .modern-log {
        font-size: 8px;
        max-height: 80px;
    }
}

/* Desktop sidebar ocultable */
@media (min-width: 769px) {
    .modern-sidebar {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .modern-sidebar.hidden {
        transform: translateX(-100%);
    }
    
    .desktop-toggle {
        display: block;
    }
    
    .main-content.expanded {
        margin-left: 0;
    }
}

/* =============================================================================
   ANIMACIONES Y EFECTOS
   ============================================================================= */

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

.modern-section {
    animation: fadeIn 0.3s ease-out;
}

.modern-section:nth-child(1) { animation-delay: 0.1s; }
.modern-section:nth-child(2) { animation-delay: 0.2s; }
.modern-section:nth-child(3) { animation-delay: 0.3s; }
.modern-section:nth-child(4) { animation-delay: 0.4s; }
.modern-section:nth-child(5) { animation-delay: 0.5s; }

/* =============================================================================
   ESTADOS DE HOVER Y FOCUS MEJORADOS
   ============================================================================= */

.modern-select:hover, .modern-range:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(30, 41, 59, 0.9);
}

.modern-checkbox:hover input[type="checkbox"] {
    transform: scale(1.3);
}

.auto-rot-item:hover input[type="checkbox"] {
    transform: scale(1.4);
}

/* =============================================================================
   SCROLLBAR PERSONALIZADO PARA EL SIDEBAR
   ============================================================================= */

.modern-sidebar::-webkit-scrollbar {
    width: 8px;
}

.modern-sidebar::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.2);
    border-radius: 4px;
}

.modern-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modern-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

/* =============================================================================
   EFECTOS DE GLOW Y SOMBRAS
   ============================================================================= */

.modern-sidebar {
    box-shadow: 
        4px 0 20px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modern-section:hover {
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(59, 130, 246, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modern-button {
    box-shadow: 
        0 2px 8px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.modern-button:hover {
    box-shadow: 
        0 4px 12px rgba(59, 130, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
} 