@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

/* Elegant Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Sidebar Specific Scrollbar - hidden when not scrolling if possible or just very thin */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar:not(:hover)::-webkit-scrollbar-thumb {
    background: transparent;
}

:root {
    --primary-red: #E50914;
    --primary-yellow: #B8860B;
    /* Darker Gold for visibility */
    --bg-color: #f4f6f9;
    --panel-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --sidebar-bg: #1a1a1a;
    --sidebar-bg-light: #ffffff;
    --neon-glow-red: 0 4px 6px rgba(229, 9, 20, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 0.95rem;
    line-height: 1.6;
    text-transform: uppercase;
    /* Force all text to uppercase */
}

input,
textarea,
select,
button {
    text-transform: uppercase;
}

/* Typography Overrides to Poppins */
h1,
h2,
h3,
h4,
h5,
h6,
.stat-value,
.btn-action,
.page-link,
.start-btn {
    font-family: 'Poppins', sans-serif !important;
    letter-spacing: 0.5px;
}

h1,
h2,
h3 {
    font-weight: 700;
    color: #222;
}

/* Helpers */
.text-red {
    color: var(--primary-red) !important;
}

.text-yellow {
    color: var(--primary-yellow) !important;
}

/* Darker yellow for white bg visibility */
.text-green {
    color: #28a745 !important;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.sidebar {
    width: 220px;
    background: #1e1e1e;
    border-right: 1px solid #333;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 30px;
    background-color: var(--bg-color);
    transition: all 0.3s ease;
    width: calc(100% - 220px);
    min-width: 0;
    /* Prevent flex items from overflowing */
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    margin: 0;
    color: var(--primary-red);
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 1px;
    transition: all 0.2s;
    text-align: center;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
}

.nav-link.active {
    background-color: var(--primary-red);
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.3);
}

.nav-link i {
    display: none;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-red);
}

.stat-card.yellow {
    border-top-color: var(--primary-yellow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #222;
    margin: 10px 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 0;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    /* Smooth mobile scroll */
}

/* Subtle gradient to indicate horizontal scroll on mobile */
.table-responsive::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 15px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.02));
    pointer-events: none;
    z-index: 5;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.custom-table th {
    background: #fafafa;
    color: #444;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.custom-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    font-size: 0.8rem;
}

.custom-table tr:hover {
    background-color: #f9f9f9;
}

/* Forms & Inputs */
.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    background: #ffffff;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #333;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: var(--primary-red);
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
}

.input-field::placeholder {
    color: #999;
}

.input-field:disabled,
.input-field[readonly] {
    background-color: #f2f2f2 !important;
    color: #666 !important;
    cursor: default;
    border-color: #ccc !important;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.search-bar form,
.search-bar .input-group {
    margin-bottom: 0;
    flex-grow: 1;
}

.search-bar .start-btn,
.search-bar .btn-action {
    white-space: nowrap;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 30px 0 10px 0;
    gap: 8px;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.page-item.active .page-link {
    background: var(--primary-yellow);
    border-color: var(--primary-yellow);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(184, 134, 11, 0.2);
}

.page-link:hover:not(.active) {
    background: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-2px);
}

/* Pagination Dots Helper */
.pagination .page-link[style*="background:transparent"] {
    background: transparent !important;
    border: none !important;
    cursor: default;
    min-width: 20px;
    padding: 0;
}

/* Buttons */
.start-btn {
    background: var(--primary-red);
    color: #fff !important;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--neon-glow-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.start-btn:hover:not(:disabled) {
    background: #cc0000;
    transform: translateY(-1px);
}

.start-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.btn-view {
    background-color: #fefce8;
    color: #a16207 !important;
    border: 1px solid #fef08a;
}

.btn-view:hover {
    background-color: #fef08a;
    color: #854d0e !important;
    transform: translateY(-1px);
}

.btn-blue {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-blue:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
    border: none;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-green:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-delete {
    background-color: #fee2e2;
    color: #b91c1c !important;
    border: 1px solid #fecaca;
}

.btn-delete:hover {
    background-color: #fecaca;
    color: #991b1b !important;
}

/* Modals - Light Theme Enforcement */
div[id*="modal"] {
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5000;
    justify-content: center;
    align-items: center;
}

div[id*="modal"] .stat-card {
    background: #ffffff;
    color: #333;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: none;
    width: 95%;
    max-width: 600px;
    margin: 20px auto;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Asegurar que las listas dentro de modales sean visibles */
div[id*="modal"] .stat-card>div[id*="lista"] {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 400px;
}

div[id*="modal"] p {
    color: #555 !important;
    font-size: 0.95rem;
    margin-bottom: 25px;
}

div[id*="modal"] h2,
div[id*="modal"] h3,
div[id*="modal"] h4 {
    color: #222 !important;
    border-bottom: 2px solid var(--primary-red);
    padding-bottom: 15px;
    margin-top: 0;
}

div[id*="modal"] label {
    color: #555 !important;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

div[id*="modal"] .input-field {
    background: #ffffff !important;
    border: 2px solid #ddd !important;
    color: #333 !important;
}

div[id*="modal"] .input-field:focus {
    border-color: var(--primary-red) !important;
}

/* Login Page specific */
/* Login Page - Speedometer Design */
.login-body {
    background: radial-gradient(circle at center, #2b323c 0%, #1a1a1a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0;
    font-family: 'Exo 2', sans-serif;
}

.login-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.speedometer-container {
    position: relative;
    width: 420px;
    height: 420px;
    background: #111;
    border-radius: 50%;
    box-shadow:
        0 0 0 10px #1a1a1a,
        0 0 0 12px #333,
        0 0 50px rgba(0, 0, 0, 0.8),
        inset 0 0 60px rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Gauge Ring (The glowing rim) */
.gauge-ring {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border-radius: 50%;
    border: 5px solid transparent;
    border-top-color: #00d2ff;
    border-right-color: #00d2ff;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    border-left-color: #00d2ff;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.2);
    transform: rotate(45deg);
    pointer-events: none;
}

/* Ticks around the edge */
.gauge-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
}

.tick {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 15px;
    background: #444;
    transform-origin: 50% 210px;
    /* Radius of container (420/2) */
    transform: translateX(-50%) rotate(0deg);
}

.t-1 {
    transform: translateX(-50%) rotate(-120deg);
    background: #fff;
    height: 20px;
}

.t-2 {
    transform: translateX(-50%) rotate(-90deg);
}

.t-3 {
    transform: translateX(-50%) rotate(-60deg);
}

.t-4 {
    transform: translateX(-50%) rotate(-30deg);
    background: #fff;
    height: 20px;
}

.t-5 {
    transform: translateX(-50%) rotate(0deg);
}

.t-6 {
    transform: translateX(-50%) rotate(30deg);
}

.t-7 {
    transform: translateX(-50%) rotate(60deg);
    background: #e50914;
    height: 20px;
    box-shadow: 0 0 10px #e50914;
}

.t-8 {
    transform: translateX(-50%) rotate(90deg);
    background: #e50914;
    height: 20px;
    box-shadow: 0 0 10px #e50914;
}

.t-9 {
    transform: translateX(-50%) rotate(120deg);
    background: #e50914;
    height: 20px;
    box-shadow: 0 0 10px #e50914;
}

/* Inner Content Area */
.gauge-inner {
    position: absolute;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle at center, #222 0%, #000 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 1),
        0 0 10px rgba(255, 255, 255, 0.05);
    padding: 20px;
}

.login-logo {
    width: 100px;
    opacity: 0.8;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.rpm-text {
    font-size: 0.7rem;
    color: #666;
    letter-spacing: 2px;
    margin-bottom: 20px;
    font-weight: 700;
}

/* Digital Inputs */
.input-display {
    width: 100%;
    margin-bottom: 12px;
    position: relative;
    text-align: center;
}

.input-display label {
    display: block;
    color: #00d2ff;
    font-size: 0.6rem;
    letter-spacing: 1px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.input-display input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    border-bottom: 2px solid #00d2ff;
    color: #fff;
    width: 80%;
    padding: 8px;
    text-align: center;
    font-family: 'Orbitron', monospace;
    /* Use a tech font if available, fallback monospace */
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s;
    border-radius: 4px;
}

.input-display input:focus {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

.warning-light {
    color: #ff3333;
    font-size: 0.8rem;
    margin: 5px 0 10px 0;
    text-shadow: 0 0 5px #ff3333;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: 0.5;
    }
}

/* Push Start Button */
.push-start-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: none;
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #990000);
    box-shadow:
        0 0 0 4px #111,
        0 0 0 6px #555,
        0 10px 20px rgba(0, 0, 0, 0.8),
        inset 0 0 10px rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
    margin-top: 5px;
}

.push-start-btn:active {
    transform: scale(0.95);
    box-shadow:
        0 0 0 4px #111,
        0 0 0 6px #555,
        0 5px 10px rgba(0, 0, 0, 0.8),
        inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.push-start-btn strong {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.push-start-btn span {
    font-size: 0.55rem;
    opacity: 0.8;
    letter-spacing: 1px;
}

/* Hover glow for button */
.push-start-btn:hover {
    box-shadow:
        0 0 0 4px #111,
        0 0 0 6px #fff,
        0 0 20px rgba(255, 0, 0, 0.6);
}

/* Responsive */
@media (max-width: 480px) {
    .speedometer-container {
        transform: scale(0.85);
    }
}

/* Mobile Responsiveness & Sidebar */
@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        /* Off-canvas */
        border-right: 1px solid var(--border-color);
        box-shadow: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
        /* Deep shadow */
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        width: 100%;
    }

    /* Overlay for sidebar */
    .dashboard-layout::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    /* Only show overlay if sidebar suggests it - but we need JS for that logic usually. 
       Actually, common pattern is sidebar.active + overlay. 
       Let's assume the JS toggles .active on sidebar. 
       We can target overlay if it's a sibling, but here it's ::after on layout.
    */
    body:has(.sidebar.active) .dashboard-layout::after {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-header {
        display: block;
        /* Show header on mobile */
        padding-top: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Modal Mobile Fixes */
    div[id*="modal"] .stat-card {
        width: 90%;
        margin: 5% auto;
        padding: 20px;
    }

    /* Form Mobile Layout */
    .input-group {
        margin-bottom: 15px;
    }

    /* Adjust buttons */
    .start-btn {
        width: 100%;
        margin-top: 10px;
    }

    /* Modales específicos */
    .modal-proveedor,
    .modal-orden,
    .modal-codigo {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9998;
        justify-content: center;
        align-items: center;
        backdrop-filter: blur(5px);
        overflow: visible !important;
    }

    /* Quitar backdrop-filter blur para evitar efecto borroso en listas */
    .modal-proveedor {
        backdrop-filter: none !important;
        overflow: visible !important;
        z-index: 9999 !important;
    }

    .modal-orden .stat-card,
    .modal-codigo .stat-card {
        width: 90%;
        max-width: 550px;
        max-height: 80vh;
        display: flex;
        flex-direction: column;
        background: #fff;
        padding: 25px;
        border-radius: 15px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
        overflow: visible;
        justify-content: flex-start;
    }

    /* Proveedor: SIN flexbox para apilamiento natural */
    .modal-proveedor .stat-card {
        width: 90%;
        max-width: 550px;
        max-height: 80vh;
        background: #fff;
        padding: 25px;
        border-radius: 15px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        overflow-x: hidden;
        position: relative;
        z-index: 10000 !important;
    }

    /* Lista dentro de modales de orden/codigo (con flex) */
    .modal-orden .modal-lista,
    .modal-codigo .modal-lista {
        overflow-y: auto;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        min-height: 100px;
        max-height: 300px;
        margin: 15px 0;
        padding: 10px;
        width: 100%;
    }

    /* Lista de proveedores - SIN flex, se adapta al contenido */
    .modal-proveedor .modal-lista {
        overflow-y: auto;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        min-height: 50px;
        max-height: 250px;
        margin: 15px 0;
        padding: 10px;
        width: 100%;
        position: relative !important;
        z-index: 10001 !important;
        overflow: visible !important;
    }

    /* Items de sugerencia */
    .modal-lista .suggestion-item,
    .modal-lista-proveedor .suggestion-item {
        display: block;
        padding: 12px 15px;
        margin: 5px 0;
        background: #fff;
        border: 1px solid #eee;
        border-radius: 4px;
        color: #333;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.2s;
    }

    .modal-lista .suggestion-item:hover {
        background: #f5f5f5;
        border-color: #ccc;
    }


    /* ============================================
   ESTILOS PARA SUGERENCIAS LOCALES EN TABLA
   ============================================ */
    /* Asegurar que las sugerencias en agregar_refacciones se vean bien */
    .autocomplete-wrapper .suggestions-list {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        width: 100% !important;
        min-width: 250px !important;
        background: #ffffff !important;
        border: 2px solid #333 !important;
        border-radius: 8px !important;
        z-index: 99999 !important;
        max-height: 250px !important;
        overflow-y: auto !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    }
}

/* ============================================
   ESTILOS DE EMERGENCIA - Modal Listas
   ============================================ */

/* Forzar visibilidad de items */
#lista-proveedores-modal .suggestion-item,
#lista-ordenes-modal .suggestion-item,
#lista-codigos-modal .suggestion-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #000000 !important;
    background-color: #ffffff !important;
    padding: 15px !important;
    border-bottom: 1px solid #eee !important;
    position: relative !important;
    z-index: 10003 !important;
}

/* Hover effect */
#lista-proveedores-modal .suggestion-item:hover,
#lista-ordenes-modal .suggestion-item:hover,
#lista-codigos-modal .suggestion-item:hover {
    background-color: #f0f0f0 !important;
}

/* ============================================
   ESTILOS PARA INVENTARIO - SALIDA
   ============================================ */
/* Listas de órdenes y refacciones en modal de salida */
#lista_ordenes_salida,
#lista_ref_salida {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff !important;
    border: 1px solid #ddd !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    z-index: 100 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    border-radius: 0 0 10px 10px !important;
}

#lista_ordenes_salida div,
#lista_ref_salida div {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 12px 15px !important;
    cursor: pointer !important;
    border-bottom: 1px solid #eee !important;
    background: #ffffff !important;
    color: #000000 !important;
}

#lista_ordenes_salida div:hover,
#lista_ref_salida div:hover {
    background: #fff9c4 !important;
    color: #d32f2f !important;
}

/* Lista del buscador avanzado en modal de salida */
#lista-ref-salida-modal {
    flex-grow: 1;
    overflow-y: auto !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    border: 2px solid #eee !important;
    min-height: 400px !important;
    padding: 10px !important;
}

#lista-ref-salida-modal .suggestion-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 15px !important;
    margin: 5px 0 !important;
    border: 1px solid #ccc !important;
    cursor: pointer !important;
}

#lista-ref-salida-modal .suggestion-item:hover {
    background-color: #f0f0f0 !important;
}

/* ============================================
   MODAL SALIDA EN INVENTARIO
   ============================================ */
/* Permitir que las listas desplegables se vean fuera del modal */
#modal-salida .stat-card {
    overflow: visible !important;
}

/* Asegurar que el contenedor de input tenga position relative */
#modal-salida div[style*="position: relative"] {
    position: relative;
}

/* Forzar visibilidad y comportamiento de las listas en el flujo del modal */
#lista_ordenes_salida,
#lista_ref_salida {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Items de las listas (Solo hijos directos) */
#lista_ordenes_salida>div,
#lista_ref_salida>div {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 12px 15px !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

/* Evitar que elementos internos hereden fondos blancos o paddings extra */
#lista_ordenes_salida div div,
#lista_ref_salida div div,
#lista_ref_salida div span {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    display: inline-flex !important;
}

#lista_ordenes_salida>div:hover,
#lista_ref_salida>div:hover {
    background: #fdf2f2 !important;
    border-left: 4px solid var(--primary-red) !important;
}

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

.modal-salida-card {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    overflow: visible !important;
    position: relative;
    z-index: 10000;
}

/* ============================================
   MODAL BUSCAR REFACCIÓN DISPONIBLE (AVANZADO)
   ============================================ */
#modal-buscar-ref-salida {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2500;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#modal-buscar-ref-salida .stat-card {
    width: 90%;
    max-width: 700px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    overflow: visible !important;
}

/* Lista del buscador avanzado */
#lista-ref-salida-modal {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    min-height: 200px !important;
    max-height: 400px !important;
    padding: 10px !important;
    margin: 10px 0 !important;
}

/* Items de sugerencia en el buscador avanzado */
#lista-ref-salida-modal .suggestion-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #ffffff !important;
    color: #000000 !important;
    padding: 15px !important;
    margin: 8px 0 !important;
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
}

#lista-ref-salida-modal .suggestion-item:hover {
    background: #e3f2fd !important;
    border-color: #2196f3 !important;
}

/* Contenido interno de los items */
#lista-ref-salida-modal .suggestion-item div {
    color: #000 !important;
}

#lista-ref-salida-modal .suggestion-item strong {
    color: #000 !important;
    font-size: 1.05rem;
}

#lista-ref-salida-modal .suggestion-item span {
    color: #333 !important;
}

/* Ensure modal containers don't clip dropdowns */
.modal-proveedor,
.modal-orden,
.modal-codigo,
.modal-salida {
    overflow: visible !important;
    z-index: 9999 !important;
}

/* Fix modal positioning and overflow */
.modal-proveedor .stat-card,
.modal-orden .stat-card,
.modal-codigo .stat-card {
    overflow: hidden !important;
    /* Contain the list */
    position: relative;
    max-height: 85vh;
    /* Don't exceed viewport */
    z-index: 10000 !important;
}

/* Ensure modal lists are properly contained and scrollable */
.modal-proveedor .modal-lista,
.modal-orden .modal-lista,
.modal-codigo .modal-lista,
#lista-proveedores-modal,
#lista-ordenes-modal,
#lista-codigos-modal {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 10001 !important;
    overflow-y: auto !important;
    min-height: 150px;
    max-height: 300px !important;
    /* Fixed height for consistency */
    border: 1px solid #ddd;
    margin-top: 15px;
    background: #fff;
}