/* utilidades.css - Keyframes, utilidades de responsive y scrollbars */

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

@keyframes pulseBorder {
    from { border-color: rgba(194, 94, 67, 0.3); }
    to { border-color: rgba(212, 125, 99, 0.8); }
}

@keyframes modalScaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

/* Sidebar Overlay para Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* General Layout adjustments on mobile (Responsive menu) */
@media (max-width: 768px) {
    aside {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        padding: 2rem 1.5rem;
        background-color: rgba(24, 24, 27, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-right: 1px solid var(--border-color);
        border-bottom: none;
    }
    aside.open {
        transform: translateX(0);
    }
    .brand {
        display: flex !important;
        margin-bottom: 2rem;
    }
    .sidebar-logo-bottom {
        display: flex !important;
        margin-bottom: 0.5rem;
    }
    nav {
        flex-direction: column !important;
        overflow-x: visible !important;
        flex-grow: 1 !important;
    }
    .nav-item {
        white-space: normal;
        padding: 0.85rem 1.25rem !important;
        width: 100% !important;
        display: flex !important;
    }
    .nav-item.active {
        border-left: 3px solid var(--primary) !important;
        border-bottom: none !important;
        padding-bottom: 0.85rem !important;
    }
    .user-panel {
        display: flex !important;
    }
    main {
        margin-left: 0;
        padding: 1rem;
    }
    .btn-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-color);
        color: var(--text-main);
        cursor: pointer;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-sm);
        flex-shrink: 0;
        transition: all 0.2s ease;
    }
    .btn-sidebar-toggle:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--border-focus);
    }
    header {
        flex-direction: row !important;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
    }
    .header-title {
        flex-grow: 1;
    }
    .header-actions {
        width: auto !important;
    }
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .search-container {
        max-width: 100%;
        width: 100%;
    }
    .filters-container {
        width: 100%;
        justify-content: flex-start;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    .filters-container button {
        flex: 1 1 auto;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        height: 38px;
    }
    .controls-bar .view-selector {
        width: 100%;
        display: flex;
    }
    .controls-bar .view-selector .btn-view-mode {
        flex: 1 1 50%;
        width: 50%;
        justify-content: center;
        text-align: center;
    }
    .btn-theme {
        width: 38px;
        height: 38px;
    }
    .quick-filters-bar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        width: 100%;
    }
    .filter-pill {
        white-space: nowrap;
        flex-shrink: 0;
    }
    /* Evitar scroll horizontal en la sección de inventario */
    main {
        overflow-x: hidden;
    }
    /* En vista flat, la tabla queda contenida en su propio scroll, no en el de la página */
    .flat-ip-group .ip-desktop-table {
        max-width: calc(100vw - 2rem);
        overflow-x: auto;
    }
    /* Botones de acción en la barra de filtros: que hagan wrap sin sobresalir */
    /* Modales adaptados a móvil y teclado virtual */
    .modal-overlay {
        padding: 0.5rem;
        align-items: center;
    }
    .modal-content {
        max-height: 94dvh;
        max-height: 94vh;
        border-radius: var(--radius-main);
        width: 100%;
    }
    .modal-header {
        padding: 0.9rem 1.15rem;
    }
    .modal-header h3 {
        font-size: 1.1rem;
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    .modal-footer > div {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    .modal-footer button,
    .modal-footer .btn {
        flex: 1 1 auto;
        min-height: 42px;
        justify-content: center;
        font-size: 0.9rem;
    }
    
    /* Formularios de modal a 1 sola columna limpia en móvil */
    .form-grid,
    .modal-content.wide .form-grid,
    .bulk-aula-fields {
        grid-template-columns: 1fr !important;
        gap: 0.85rem;
    }
    .form-group.full-width,
    .modal-content.wide .form-group.full-width,
    .adjudicacion-fields,
    .modal-content.wide .adjudicacion-fields,
    .adjudicacion-title,
    .modal-content.wide .adjudicacion-title {
        grid-column: span 1 !important;
    }
    .adjudicacion-fields {
        grid-template-columns: 1fr !important;
        padding: 0.85rem;
    }
    
    /* Evitar auto-zoom molesto en inputs en iOS (mínimo 16px) */
    .form-control,
    .filter-select,
    .search-input,
    .bulk-field-control {
        font-size: 16px !important;
        min-height: 40px;
    }
}

/* Custom Scrollbars */
#free-ips-container::-webkit-scrollbar {
    width: 6px;
}

#free-ips-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
