/* =============================================
   Colores de estado personalizados
   ============================================= */
.bg-purple            { background-color: #6f42c1 !important; color: #fff; }
.bg-orange            { background-color: #fd7e14 !important; color: #fff; }
.bg-devolucion        { background-color: #fd7e14 !important; color: #fff; }
.bg-devuelto-sucursal { background-color: #000    !important; color: #FFD700; }
.bg-cancelado         { background-color: #dc3545 !important; color: #fff; }

/* =============================================
   Validación de campos requeridos
   ============================================= */
select.is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220,53,69,.25) !important;
}

/* =============================================
   Variables de identidad visual
   ============================================= */
:root {
    --amarillo: #FFC107;
    --amarillo-oscuro: #e0a800;
    --texto-sobre-amarillo: #212529;
    --sidebar-ancho: 200px;
    --topbar-alto: 110px;
    --footer-alto: 40px;
    --sidebar-bg: #3a3a3a;
}

/* =============================================
   Layout general
   ============================================= */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================
   Topbar
   ============================================= */
.topbar {
    height: var(--topbar-alto);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--amarillo-oscuro);
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: visible;
}

/* Avatar usuario */
.avatar-usuario {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background-color: rgba(0,0,0,0.12);
    color: #212529;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    border: 2px solid rgba(0,0,0,0.15);
}

/* Nombre de la tienda */
.topbar-nombre-tienda {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 2px;
}

.topbar-teocali {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    letter-spacing: 2px;
}

.topbar-subtitulo {
    font-size: 0.7rem;
    line-height: 1.4;
}

.topbar-separador {
    width: 40px;
    height: 1px;
    background: rgba(0,0,0,0.25);
    margin: 3px auto;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
    width: var(--sidebar-ancho);
    flex-shrink: 0;
    position: sticky;
    top: var(--topbar-alto);
    height: calc(100vh - var(--topbar-alto));
    overflow-y: auto;
    background-color: var(--sidebar-bg) !important;
}

.nav-sidebar {
    color: #adb5bd !important;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s;
}

.nav-sidebar:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff !important;
}

.nav-sidebar.activo {
    background-color: var(--amarillo);
    color: var(--texto-sobre-amarillo) !important;
    font-weight: 600;
}

.nav-sidebar.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.sidebar .nav-item::after {
    content: '';
    display: block;
    margin: 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

/* =============================================
   Contenido principal
   ============================================= */
.contenido-principal {
    min-height: calc(100vh - var(--topbar-alto));
    display: flex;
    flex-direction: column;
}

/* =============================================
   Footer fijo
   ============================================= */
.footer-fijo {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-alto);
    z-index: 1000;
    border-top: 2px solid var(--amarillo-oscuro);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* =============================================
   Identidad amarilla
   ============================================= */
.bg-amarillo {
    background-color: var(--amarillo) !important;
}

.btn-amarillo {
    background: #fff;
    border-color: var(--amarillo-oscuro);
    color: var(--texto-sobre-amarillo);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: box-shadow 0.15s, background 0.15s;
}

.btn-amarillo:hover {
    background: var(--amarillo);
    border-color: var(--amarillo-oscuro);
    color: var(--texto-sobre-amarillo);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

/* Botón Estado en filas de pedido */
.btn-estado-fila {
    background: #fff;
    border: 1px solid #ced4da;
    color: #495057;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-estado-fila:hover {
    background: #495057;
    border-color: #495057;
    color: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.thead-amarillo th {
    background-color: var(--amarillo);
    color: var(--texto-sobre-amarillo);
    border-color: var(--amarillo-oscuro);
}

#filtroEstado option {
    background-color: #fff;
    color: #212529;
    font-weight: normal;
}

/* =============================================
   Home - tarjetas
   ============================================= */
.icono-card {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 50% !important;
    flex-shrink: 0;
}

.acceso-rapido {
    transition: transform 0.15s, box-shadow 0.15s;
}

.acceso-rapido:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1) !important;
}

/* =============================================
   Tabla de detalle
   ============================================= */
#tablaDetalle tbody tr td input,
#tablaDetalle tbody tr td select {
    min-width: 80px;
}

/* =============================================
   Punto de estado activo
   ============================================= */
.punto-activo {
    display: inline-block;
    width: 10px;
    height: 10px;
    min-width: 10px;
    background-color: #22c55e;
    border-radius: 50%;
    animation: respirar 2s ease-in-out infinite;
    vertical-align: middle;
    margin-left: 4px;
}

@keyframes respirar {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 4px 1px rgba(34, 197, 94, 0.5);
    }
    50% {
        transform: scale(1.4);
        box-shadow: 0 0 10px 4px rgba(34, 197, 94, 0.9);
    }
}

/* =============================================
   Badges y botones pequeños
   ============================================= */
.badge-estado {
    font-size: 0.8rem;
    padding: 0.4em 0.7em;
}

.btn-fila-eliminar {
    padding: 2px 8px;
    font-size: 0.85rem;
}

/* =============================================
   Fade-in al cargar página
   ============================================= */
.contenido-principal {
    animation: fadeIn 0.35s ease;
}

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

/* =============================================
   Hover suave en tablas
   ============================================= */
.table-hover > tbody > tr {
    transition: background-color 0.15s ease;
    cursor: default;
}
.table-hover > tbody > tr[style*="cursor:pointer"],
.table-hover > tbody > tr[onclick] {
    cursor: pointer;
}

/* Celdas compactas en tablas de listado */
#listaPedidos td,
#cabeceraTabla th {
    font-size: 0.82rem;
    padding: 0.3rem 0.45rem;
    vertical-align: middle;
}

/* Columna No. Pedido al mínimo necesario */
.col-numero-pedido {
    width: 1%;
    white-space: nowrap;
}

/* Evitar scroll horizontal en tablas dentro de cards */
.card .table-responsive {
    overflow-x: clip;
}

/* =============================================
   Skeleton loader
   ============================================= */
.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================
   Tarjetas de estadísticas home
   ============================================= */
.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
}
