/* =========================================
   RESET & BASE
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #333;
    font-size: 14px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */
header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
}

/* Menú Móvil (Oculto por defecto) */
.mobile-menu {
    display: none;
    /* JS toggle 'flex' */
    position: absolute;
    top: 50px;
    left: 10px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    min-width: 200px;
    z-index: 1000;
}

.mobile-menu a {
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu a:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

.mobile-menu.show {
    display: flex;
}

/* Contenedor Central */
.container {
    flex: 1;
    padding: 20px;
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* =========================================
   SISTEMA DE PESTAÑAS (TABS)
   ========================================= */
/* =========================================
   SISTEMA DE PESTAÑAS (TABS)
   ========================================= */
.tabs-header {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0;
    margin-bottom: 0;
    width: 100%;
    /* Ensure full width for tabs line */
    justify-content: flex-start;
    /* Always align left */
}

.tab-btn {
    padding: 10px 20px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background-color: #dfe4ea;
    color: #3498db;
}

.tab-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* =========================================
   CONTENIDO DE PESTAÑAS
   ========================================= */
.tab-content {
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    padding: 20px;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: none;
    /* Oculto por defecto */
    width: 100%;
    /* Fill the container */
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
    /* Solo el activo se muestra */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   TABLA DE INVENTARIO
   ========================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.inventario-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.inventario-table th,
.inventario-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.inventario-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    /* Sortable */
    user-select: none;
    white-space: nowrap;
}

.inventario-table th:hover {
    background-color: #e2e6ea;
}

.inventario-table tr:hover {
    background-color: #f1f1f1;
}

.inventario-table td {
    font-size: 0.9rem;
}

/* Sort Icons */
.sort-icon {
    margin-left: 5px;
    font-size: 0.8rem;
    color: #ccc;
}

.active-asc .sort-icon::before {
    content: "\f0de";
    color: #3498db;
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.active-desc .sort-icon::before {
    content: "\f0dd";
    color: #3498db;
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}


/* =========================================
   BOTONES Y FORMULARIOS
   ========================================= */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.search-box input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 250px;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
    color: white;
}

.btn-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #2ecc71;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-info {
    background-color: #17a2b8;
}

.btn-info:hover {
    background-color: #138496;
}

/* Excel Upload Area */
.drop-area {
    border: 2px dashed #ccc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    color: #777;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #fafafa;
}

.drop-area:hover,
.drop-area.dragover {
    border-color: #3498db;
    background-color: #ebf5fb;
    color: #3498db;
}

.drop-area i {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Formulario Nuevo Producto */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Badges */
.badge-si {
    background: #d4edda;
    color: #155724;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-no {
    background: #f8d7da;
    color: #721c24;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Acciones de tabla (3 puntos) */
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #777;
    padding: 5px;
}

.action-menu {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    display: none;
    z-index: 50;
    right: 20px;
}

.action-menu.show {
    display: block;
}

.action-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 15px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
}

.action-menu button:hover {
    background-color: #f1f1f1;
}

.action-menu button.delete {
    color: #e74c3c;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tabs-header {
        overflow-x: auto;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input {
        width: 100%;
    }
}

/* =========================================
   MODAL & OVERLAYS
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close-modal {
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================================
   AUTOCOMPLETE SEARCH RESULT
   ========================================= */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #cbd5e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
    font-size: 0.95rem;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #ebf8ff;
    color: #2b6cb0;
}

.search-result-item strong {
    color: #2d3748;
}