/**
 * Custom CSS - IONA System
 * Estilos personalizados adicionales para el sistema
 */

/* Animaciones personalizadas */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Clases de utilidad */
.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Efectos hover mejorados */
.hover-lift {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Loading spinner personalizado */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7e324e;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para el visor JSON */
.json-viewer-container {
    font-family: 'Courier New', monospace;
}

.json-content {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
}

.json-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Scrollbar personalizado */
.json-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.json-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.json-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estilos para archivos */
.file-item {
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.file-item:hover {
    border-color: #7e324e;
    box-shadow: 0 4px 12px rgba(126, 50, 78, 0.15);
    transform: translateY(-1px);
}

.file-item.selected {
    border-color: #7e324e;
    box-shadow: 0 0 0 3px rgba(126, 50, 78, 0.1);
}

/* === ESTILOS DEL SIDEBAR === */
#sidebar {
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    /* Prefijos para iOS Safari */
    -webkit-transition: -webkit-transform 0.3s ease-in-out;
    -webkit-transform: translateZ(0); /* Forzar aceleración hardware */
    will-change: transform; /* Optimización de rendering */
}

/* Estilos para móvil - iOS Safari compatible */
@media (max-width: 1023px) {
    #sidebar {
        transform: translateX(-100%) !important;
        -webkit-transform: translateX(-100%) !important;
        /* Forzar reflow en iOS */
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }
    
    #sidebar.sidebar-open {
        transform: translateX(0) !important;
        -webkit-transform: translateX(0) !important;
    }
    
    #sidebar-overlay {
        transition: opacity 0.3s ease-in-out;
        -webkit-transition: opacity 0.3s ease-in-out;
        z-index: 999;
        /* Mejorar rendimiento en iOS */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Fix para viewport en iOS */
    #sidebar-overlay.hidden {
        display: none !important;
        visibility: hidden;
    }
    
    #sidebar-overlay:not(.hidden) {
        display: block !important;
        visibility: visible;
    }
}

/* Navegación del sidebar */
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 4px 12px;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
    text-decoration: none;
}

.nav-item.active {
    background-color: #7e324e;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(126, 50, 78, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background-color: #ffffff;
    border-radius: 2px;
}

.nav-item i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
    font-size: 16px;
}

.nav-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.1), transparent);
    backdrop-filter: blur(10px);
}

.sidebar-footer .text-white {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Botones principales */
.btn-primary {
    background-color: #7e324e;
    border-color: #7e324e;
    transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
    background-color: #6b2a42;
    border-color: #6b2a42;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(126, 50, 78, 0.3);
}
/* Estilos para notificaciones */
.notification-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #3730a3);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(85, 85, 227, 0.3);
}

/* Efectos para notificaciones */
.notification-enter {
    animation: notificationSlideIn 0.3s ease-out;
}

.notification-exit {
    animation: notificationSlideOut 0.3s ease-in;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notificationSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Notification positioning for new layout */
.notification {
    position: fixed;
    top: 80px; /* Below top bar */
    right: 20px;
    z-index: 1000;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.notification.show {
    transform: translateX(0);
}

/* Estilos responsivos mejorados */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .file-item {
        padding: 12px;
    }
    
    .json-content {
        font-size: 12px;
    }
    
    .viewer-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .notification {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        margin: 0 10px;
    }
    
    .viewer-controls button {
        flex: 1;
        min-width: 120px;
    }
    
    /* iOS Safari específico */
    #mobile-menu-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    #close-sidebar-btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    /* Forzar aceleración hardware en elementos principales */
    #sidebar, #sidebar-overlay {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
}

/* Estados de validación */
.validation-success {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.validation-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Efectos de focus mejorados */
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #7e324e;
    box-shadow: 0 0 0 3px rgba(126, 50, 78, 0.1);
}

/* Tooltips personalizados */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    animation: fadeIn 0.2s ease-in-out;
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}

/* Mejoras de accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Estados de loading para elementos */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estilos para modo oscuro (futuro) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1f2937;
        --bg-secondary: #374151;
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --border-color: #4b5563;
    }
} 