/* --- Paleta de Colores Kalua ---
    Azul Claro:       #A4161A
    Azul Diagnostilab: #A4161A
    Amarillo Crema:   #FCEE9F
    Azul Pastel:      #C2E4F4
    Gris Suave:       #f8f9fa
    Texto Oscuro:     #343a40
*/

/* --- Reseteo y Fuentes Globales --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #fdfdfd;
    color: #343a40;
    line-height: 1.6;
}

/* --- Estilos de Login y Registro --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #A4161A, #E09F3E);
}

.auth-form-wrapper {
    background-color: #fff;
    padding: 2.5rem 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.auth-form-wrapper h2 {
    color: #A4161A;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #A4161A;
}

.btn-auth {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 8px;
    background-color: #A4161A;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-auth:hover {
    background-color: #7a0c10;
}

.auth-switch-link {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.auth-switch-link a {
    color: #A4161A;
    text-decoration: none;
    font-weight: 600;
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* --- Layout del Dashboard --- */
.dashboard-layout {
    min-height: 100vh;
}

.main-wrapper {
    width: 100%;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
    /* Fixed height to match sidebar */
    padding: 0 20px;
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
}

.btn-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s ease;
    border: none;
    font-size: 1rem;
}

.btn-header-action i {
    margin-right: 8px;
}

.btn-header-action.btn-back {
    background-color: #6c757d;
    /* Un color gris para "Atrás" */
}

.btn-header-action.btn-logout {
    background-color: #A4161A;
    /* Un color rojo para "Cerrar Sesión" */
}

.btn-header-action:hover {
    background-color: #f8f9fa;
    color: var(--color-secundario, #A4161A);
    transform: scale(1.1);
}

/* Estilo específico para el botón de logout */
.btn-logout {
    color: #A4161A;
    /* Rojo para indicar una acción destructiva */
    background-color: #fff;
}

.btn-logout:hover {
    background-color: #A4161A;
    color: #fff;
    transform: scale(1.1);
}

.top-header .sidebar-toggle {
    display: none;
    /* Se elimina permanentemente */
}

/* --- Vista de Móvil (Ajustes) --- */
@media (max-width: 768px) {
    .main-wrapper {
        width: 100%;
    }
}

.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    color: #FCEE9F;
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-nav ul {
    list-style: none;
    padding-top: 1rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #C2E4F4;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    border-left: 4px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    border-left-color: #A4161A;
}

.sidebar-nav a i {
    margin-right: 1rem;
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info .user-name {
    display: block;
    font-weight: 600;
}

.user-info .user-role {
    font-size: 0.8rem;
    opacity: 0.8;
}



/* --- Estilos de la Tienda --- */
.card {
    background-color: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    background-color: transparent;
    border-bottom: 1px solid #eee;
    font-size: 1.2rem;
    font-weight: 700;
    color: #212529;
}

.card-header .fas {
    color: var(--color-primary, #A4161A);
    margin-right: 0.75rem;
}

.card-body {
    padding: 1.5rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table thead th {
    background-color: #A4161A;
    color: #fff;
    border: none;
    padding: 1rem 1.5rem;
    text-align: left;
}

.table thead th:first-child {
    border-top-left-radius: 8px;
}

.table thead th:last-child {
    border-top-right-radius: 8px;
}

.table tbody tr {
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.table tbody tr:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.table td {
    padding: 1rem 1.5rem;
    vertical-align: middle;
    border: none;
    border-top: 1px solid #f0f0f0;
}

.table td:first-child {
    border-left: 1px solid #f0f0f0;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.table td:last-child {
    border-right: 1px solid #f0f0f0;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    border-radius: 6px;
}

.btn-warning {
    background-color: #FCEE9F;
    border-color: #FCEE9F;
    color: #A4161A;
}

.btn-danger {
    background-color: #A4161A;
    border-color: #A4161A;
}

.btn-primary {
    background-color: #A4161A;
    border-color: #bb2d3b;
    color: #fff;
}

.btn-secondary {
    background-color: #ccc;
    border-color: #ccc;
}

/* --- Responsividad --- */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -260px;
    }

    .sidebar.is-open {
        margin-left: 0;
    }

    .main-wrapper {
        width: 100%;
    }
}

/* Estilos de la Galería de Productos */
.search-bar-container {
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-bar-container .form-control {
    border-left: none;
    border-radius: 0 30px 30px 0;
    height: 48px;
}

.search-bar-container .form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}

.search-icon {
    background-color: white;
    border-right: none;
    border-radius: 30px 0 0 30px;
    color: #6c757d;
}

.product-card {
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    padding: 10px;
}

.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* --- Estilos para Accesos Rápidos del Dashboard --- */
.shortcut-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: #343a40;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.shortcut-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    color: var(--color-primario, #A4161A);
}

.shortcut-card i {
    margin-bottom: 1rem;
    color: var(--color-primario, #A4161A);
    opacity: 0.8;
    transition: color 0.2s ease;
}

.shortcut-card:hover i {
    color: var(--color-primario, #A4161A);
}

.shortcut-card span {
    font-weight: 600;
    font-size: 1.1rem;
}

.info-card h4 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

/* --- Estilos de Accesos Rápidos Mejorados --- */
.shortcut-section {
    padding: 2rem;
    background-color: #fdfdfd;
    border-radius: 15px;
    margin-top: 2rem;
    border: 1px solid #f0f0f0;
}

.shortcut-section h3 {
    color: #A4161A;
    /* Marrón Chocolate */
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
}

.shortcut-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.8rem;
}

.shortcut-buttons a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.4rem 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: #343a40;
    background: #fff;
    border: 2px solid #dee2e6;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.shortcut-buttons a:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 87, 168, 0.15);
    border-color: #A4161A;
    color: #A4161A;
}

.shortcut-buttons a:nth-child(4n+1) i { color: #A4161A; }
.shortcut-buttons a:nth-child(4n+2) i { color: #A4161A; }
.shortcut-buttons a:nth-child(4n+3) i { color: #e0a800; }
.shortcut-buttons a:nth-child(4n+4) i { color: #4da6d9; }

.shortcut-buttons a:nth-child(4n+3) { border-color: #ffc10733; }
.shortcut-buttons a:nth-child(4n+4) { border-color: #4da6d933; }

.shortcut-buttons i {
    font-size: 2rem;
    margin-bottom: 0.6rem;
}

.shortcut-buttons span {
    font-weight: 600;
    font-size: 0.9rem;
}

/* --- Estilos para la visibilidad del carrito en la galería (MÉTODO NUEVO) --- */
#sales-container.cart-hidden #cart-view-col {
    display: none;
}

#sales-container.cart-hidden #product-gallery-col {
    flex: 0 0 100%;
    max-width: 100%;
}

.cart-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #A4161A;
    /* Rosa Vibrante */
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 1050;
}

.cart-fab:hover {
    transform: scale(1.1);
    background-color: #7a0c10;
    color: #fff;
}

.cart-item-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #A4161A;
    /* Marrón Chocolate */
    color: #fff;
    border-radius: 50%;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid #fff;
}

/* --- Fin de Estilos FAB --- */

/* --- Fin de Accesos Rápidos --- */

/* --- Estilos de la Tienda --- */
.product-gallery {
    border: 1px solid #e0e0e0;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-gallery:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    padding: 10px;
}

.card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}