/* ============================================
   SISTEMA DE INVENTARIO - ESTILOS PERSONALIZADOS
   ============================================ */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --sidebar-width: 250px;
}

/* Reset y base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* Contenido principal con navbar fixed */
.main-content {
    padding-top: 70px;
    min-height: 100vh;
}

/* ============================================
   LOGIN
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #0143a3 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo i {
    font-size: 4rem;
    color: var(--primary-color);
}

.login-logo h1 {
    font-size: 1.5rem;
    color: #333;
    margin-top: 0.5rem;
}

/* ============================================
   CARDS Y PANELES
   ============================================ */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
}

/* Stats Cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.dashboard-link {
    cursor: pointer;
}

.dashboard-link:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

/* ============================================
   TABLAS
   ============================================ */
.table-responsive {
    border-radius: 0.5rem;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--secondary-color);
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table .actions {
    white-space: nowrap;
}

.table .actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ============================================
   FORMULARIOS
   ============================================ */
.form-label {
    font-weight: 500;
    color: #333;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
}

/* ============================================
   BADGES Y ESTADOS
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
}

.estado-activo {
    color: var(--success-color);
}

.estado-anulado {
    color: var(--danger-color);
}

.stock-bajo {
    color: var(--danger-color);
    font-weight: 600;
}

.stock-ok {
    color: var(--success-color);
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.pagination {
    margin-bottom: 0;
}

.page-link {
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
    border: none;
    border-radius: 0.5rem;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0a5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

/* ============================================
   PÁGINA DE TÍTULOS
   ============================================ */
.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
    color: #333;
}

/* ============================================
   UTILIDADES
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

/* Tablet intermedio (≤992px) */
@media (max-width: 992px) {
    .hide-tablet {
        display: none !important;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .main-content {
        padding-top: 60px;
    }

    .main-content .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.35rem;
    }

    .page-header > .btn {
        width: 100%;
        text-align: center;
    }

    .page-header > .d-flex {
        width: 100%;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    /* Card headers con acciones */
    .card-header.d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Ocultar columnas menos importantes en móvil/tablet */
    .hide-mobile {
        display: none !important;
    }

    /* Formularios: botones de acción a ancho completo */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Mobile (≤576px) */
@media (max-width: 576px) {
    .login-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .btn {
        padding: 0.4rem 0.75rem;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }

    .stat-card .stat-icon {
        font-size: 1.6rem;
        opacity: 0.25;
    }

    .stat-card .card-body {
        padding: 0.75rem 1rem;
    }

    /* Tabla de productos en formularios (entradas/salidas) */
    .table-productos-form {
        font-size: 0.78rem;
    }

    .table-productos-form td,
    .table-productos-form th {
        padding: 0.3rem 0.25rem;
    }

    .table-productos-form .form-control,
    .table-productos-form .form-select {
        font-size: 0.78rem;
        padding: 0.2rem 0.35rem;
        height: auto;
    }

    .table-productos-form .input-group-text {
        font-size: 0.78rem;
        padding: 0.2rem 0.35rem;
    }

    /* Totales de formularios */
    .tfoot-totales td {
        font-size: 0.9rem !important;
    }

    /* Paginación compacta */
    .page-link {
        padding: 0.3rem 0.55rem;
        font-size: 0.85rem;
    }

    /* Navbar brand más corto */
    .navbar-brand {
        font-size: 0.95rem;
    }

    /* Formularios: labels */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }

    /* Botones de acción de formularios */
    .d-flex.gap-2 > .btn-lg {
        flex: 1;
    }

    /* Filtros: compactar */
    .card-body .row.g-3 {
        row-gap: 0.5rem !important;
    }
}

/* ============================================
   IMPRESIÓN
   ============================================ */
@media print {
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        padding-top: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
