/* NutriaSoft - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Montserrat:wght@700;900&display=swap');

:root {
    --red-primary: #C0392B;
    --red-dark: #922B21;
    --red-light: #E74C3C;
    --gray-dark: #2C3E50;
    --gray-mid: #6C757D;
    --gray-light: #F2F3F4;
    --gray-border: #DEE2E6;
    --white: #FFFFFF;
    --shadow: 0 2px 12px rgba(0,0,0,0.10);
    --shadow-hover: 0 6px 24px rgba(192,57,43,0.18);
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Nunito', sans-serif;
    background: #F7F8FA;
    color: var(--gray-dark);
    min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar-nutriasoft {
    background: var(--red-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar-nutriasoft .navbar-brand img { height: 38px; }
.navbar-nutriasoft .navbar-brand span { color: #fff; font-weight: 800; font-size: 1.2rem; }
.navbar-nutriasoft .nav-link { color: rgba(255,255,255,0.88) !important; font-weight: 600; }
.navbar-nutriasoft .nav-link:hover, .navbar-nutriasoft .nav-link.active { color: #fff !important; }
.navbar-nutriasoft .navbar-toggler { border-color: rgba(255,255,255,0.4); }
.navbar-nutriasoft .navbar-toggler-icon { filter: invert(1); }

/* ---- SIDEBAR ---- */
.sidebar {
    background: var(--gray-dark);
    min-height: calc(100vh - 60px);
    width: 240px;
    position: fixed;
    top: 60px;
    left: 0;
    z-index: 100;
    transition: transform 0.3s;
    overflow-y: auto;
}
.sidebar .nav-link {
    color: rgba(255,255,255,0.75);
    padding: 10px 20px;
    border-radius: 6px;
    margin: 2px 8px;
    font-weight: 600;
    transition: all 0.2s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background: var(--red-primary);
    color: #fff;
}
.sidebar .nav-link i { width: 22px; }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.main-content {
    margin-left: 240px;
    padding: 24px;
    min-height: calc(100vh - 60px);
    transition: margin-left 0.3s;
}

/* ---- CARDS ---- */
.card-nutriasoft {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 20px;
}
.card-nutriasoft .card-header {
    background: var(--red-primary);
    color: #fff;
    font-weight: 700;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 20px;
}

/* ---- BUTTONS ---- */
.btn-primary {
    background: var(--red-primary);
    border-color: var(--red-primary);
    font-weight: 700;
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-outline-primary {
    color: var(--red-primary);
    border-color: var(--red-primary);
}
.btn-outline-primary:hover { background: var(--red-primary); color: #fff; }

/* ---- LOGIN ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F7F8FA 0%, #E8E8E8 100%);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
}
.login-card .logo-wrap { text-align: center; margin-bottom: 24px; }
.login-card .logo-wrap img { height: 72px; }
.login-card h4 { color: var(--red-primary); font-weight: 800; text-align: center; margin-bottom: 6px; }
.login-footer { text-align: center; color: var(--gray-mid); font-size: 0.82rem; margin-top: 24px; }

/* ---- TABLES ---- */
.table-nutriasoft th { background: var(--gray-light); color: var(--gray-dark); font-weight: 700; }
.table-nutriasoft tbody tr:hover { background: #FDF3F2; }

/* ---- BADGES / STATUS ---- */
.badge-solicitado { background: #F39C12; color: #fff; }
.badge-en_camino  { background: #27AE60; color: #fff; }
.badge-entregado  { background: #C0392B; color: #fff; }
.badge-pagado     { background: #2980B9; color: #fff; }
.badge-cancelado  { background: #6C757D; color: #fff; }
.badge-listo_recoger { background: #0dcaf0; color: #000; }

/* ---- CATEGORIAS GRID (cliente) ---- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.cat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    padding: 18px 10px 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.cat-card:hover { border-color: var(--red-primary); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.cat-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.cat-card .cat-name { font-weight: 700; font-size: 0.9rem; color: var(--gray-dark); }
.cat-card .cat-placeholder {
    width: 64px; height: 64px; background: var(--gray-light);
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.8rem; margin-bottom: 10px;
}

/* ---- PRODUCTOS GRID ---- */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.prod-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.prod-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.prod-card img { width: 100%; height: 120px; object-fit: contain; background: #f8f8f8; display: block; }
.prod-card .prod-body { padding: 12px; }
.prod-card .prod-name { font-weight: 700; font-size: 0.92rem; }
.prod-card .prod-price { color: var(--red-primary); font-weight: 800; font-size: 1.05rem; }

/* ---- CARRITO ---- */
.carrito-panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 80px;
}
.carrito-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--gray-border); }
.carrito-item:last-child { border-bottom: none; }
.carrito-total { font-size: 1.15rem; font-weight: 800; color: var(--red-primary); }



.prod-no-disponible { opacity: 0.4; cursor: not-allowed; }
.prod-no-disponible::after { content: '🔒 Cerrado'; display:block; text-align:center; font-size:0.75rem; color:#e74c3c; }


/* ---- PEDIDOS LISTA (cliente) ---- */
.pedido-row {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--gray-border);
}
.pedido-row.solicitado { border-left-color: #F39C12; }
.pedido-row.en_camino  { border-left-color: #27AE60; }
.pedido-row.entregado  { border-left-color: #C0392B; }
.pedido-row.pagado     { border-left-color: #2980B9; }

/* ---- RECEPCION ---- */
.recepcion-card {
    border-left: 4px solid var(--red-primary);
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 14px;
    transition: all 0.2s;
}
.recepcion-card.nuevo { animation: pulseNew 1.5s ease infinite; }
@keyframes pulseNew {
    0%, 100% { box-shadow: var(--shadow); }
    50% { box-shadow: 0 0 0 4px rgba(192,57,43,0.25); }
}

/* ---- REPARTIDOR ---- */
.entrega-row {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.entrega-row:hover { box-shadow: var(--shadow-hover); }

/* ---- FORM CONTROLS ---- */
.form-control:focus, .form-select:focus {
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
}
label { font-weight: 600; font-size: 0.9rem; }

/* ---- TABS ---- */
.nav-tabs .nav-link { color: var(--gray-mid); font-weight: 600; }
.nav-tabs .nav-link.active { color: var(--red-primary); border-bottom-color: var(--red-primary); font-weight: 700; }

/* ---- FOOTER ---- */
.app-footer {
    text-align: center;
    color: var(--gray-mid);
    font-size: 0.82rem;
    padding: 16px;
    background: #fff;
    border-top: 1px solid var(--gray-border);
    margin-top: auto;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; padding: 16px; }
}

@media (max-width: 576px) {
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .prod-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 10px; }
    .login-card { padding: 28px 18px; }
}

/* ---- PRINT 80mm ---- */
@media print {
    body { background: #fff !important; font-size: 16px !important; font-weight: 700 !important; }
    .no-print { display: none !important; }
    .sidebar, .navbar, .app-footer { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .ticket-print { width: 76mm; max-width: 76mm; font-family: monospace; font-size: 16px; font-weight: 700; }
    .ticket-print h5 { font-size: 20px; text-align: center; font-weight: 900; }
    .ticket-print p, .ticket-print span, .ticket-print div { font-weight: 700; }
    .ticket-print td, .ticket-print th { font-size: 15px; padding: 3px 4px; font-weight: 700; }
    .ticket-print .sep { border-top: 2px dashed #000; margin: 5px 0; }
    @page { size: 80mm auto; margin: 2mm; }
}


/* ---- UTILS ---- */
.text-red { color: var(--red-primary) !important; }
.bg-red { background: var(--red-primary) !important; }
.fw-800 { font-weight: 800; }
.cursor-pointer { cursor: pointer; }
.img-product { width: 100%; height: 180px; object-fit: cover; border-radius: var(--radius); }

/* SweetAlert override */
.swal2-confirm { background: var(--red-primary) !important; }
.swal2-cancel { background: var(--gray-mid) !important; }
