/* =============================================
   POS Restaurante – Custom Styles (Bootstrap 5)
   ============================================= */

/* Google Font: Roboto Condensed Medium */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;600;700&display=swap');

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 56px;
    --topbar-height: 54px;
    /* Analytics / Dashboard theme (estilo Lahomes) */
    --chart-primary: #7c3aed;
    --chart-secondary: #10b981;
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-tooltip-bg: rgba(0, 0, 0, 0.85);
    --stat-icon-bg: #f3e8ff;
    --stat-icon-color: #7c3aed;
    --positive: #10b981;
    --negative: #ef4444;
}

body { font-family: 'Roboto Condensed', sans-serif; font-weight: 500; }

/* Material Icons */
.material-icons { font-size: 1.25rem; vertical-align: middle; }
.nav-icon .material-icons { font-size: 1.25rem; }
.material-icons.me-1 { margin-right: 0.25rem; }

/* ── SIDEBAR (colapsable: solo iconos cuando está cerrado) ───────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 102;
    box-shadow: 2px 0 8px rgba(0,0,0,.06);
    transition: width .25s ease, box-shadow .25s ease;
}
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 1.5rem;
    transition: margin-left .25s ease;
}
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}
/* Colapsado: ocultar textos y mostrar solo iconos */
body.sidebar-collapsed .sidebar-brand > div {
    display: none;
}
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
}
body.sidebar-collapsed .sidebar-brand .sidebar-toggle-btn {
    position: absolute;
    right: .35rem;
}
body.sidebar-collapsed .sidebar-section-label {
    display: none;
}
/* Ocultar solo el texto del enlace (el span que sigue a .nav-icon), no el icono dentro de .nav-icon */
body.sidebar-collapsed .sidebar-link .nav-icon + span {
    display: none;
}
body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: .6rem;
    color: #374151;
}
body.sidebar-collapsed .sidebar-nav {
    padding-left: 0;
    padding-right: 0;
}
body.sidebar-collapsed .sidebar-footer .badge,
body.sidebar-collapsed .sidebar-footer span.text-dark {
    display: none;
}
body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
}
body.sidebar-collapsed .sidebar-footer .btn {
    padding: .35rem;
}
body.sidebar-collapsed .sidebar .sidebar-footer .btn .material-icons {
    color: #374151 !important;
    fill: #374151;
}
body.sidebar-collapsed .sidebar .sidebar-brand .material-icons {
    color: #374151 !important;
    fill: #374151;
}
.sidebar-brand { position: relative; }
.sidebar-brand .brand-icon { font-size: 1.8rem; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem 1rem;
    color: #495057;
    font-size: .875rem;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
}
.sidebar-link:hover {
    background: #f0f4ff;
    color: #0d6efd;
    border-left-color: #b3c6ff;
}
.sidebar-link.active {
    background: #e8f0fe;
    color: #0d6efd;
    font-weight: 600;
    border-left-color: #0d6efd;
}
.sidebar-link .nav-icon { font-size: 1.1rem; display: flex; align-items: center; justify-content: center; color: inherit; }
.sidebar-link .nav-icon .material-icons { color: inherit; }
/* Colapsado: forzar color de iconos (evitar que se vean blancos) */
body.sidebar-collapsed .sidebar .sidebar-link .nav-icon,
body.sidebar-collapsed .sidebar .sidebar-link .nav-icon .material-icons {
    color: #374151 !important;
    fill: #374151;
}
body.sidebar-collapsed .sidebar .sidebar-link:hover .nav-icon,
body.sidebar-collapsed .sidebar .sidebar-link:hover .nav-icon .material-icons {
    color: #0d6efd !important;
    fill: #0d6efd;
}
body.sidebar-collapsed .sidebar .sidebar-link.active .nav-icon,
body.sidebar-collapsed .sidebar .sidebar-link.active .nav-icon .material-icons {
    color: #0d6efd !important;
    fill: #0d6efd;
}

/* ── PAGE HEADER ─────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* ── CARDS (estilo analytics / dashboard) ─── */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    background: #fff;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.stat-card .stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stat-icon-bg);
    color: var(--stat-icon-color);
}
.stat-card .stat-icon-wrap .material-icons { font-size: 1.5rem; }
.stat-card .stat-icon { font-size: 2rem; opacity: .8; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: #1f2937; }
.stat-card .stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; font-weight: 500; }
.stat-card .stat-trend { font-size: .75rem; font-weight: 600; }
.stat-card .stat-trend.positive { color: var(--positive); }
.stat-card .stat-trend.negative { color: var(--negative); }
/* Cards de contenido (gráficos, tablas) */
.card.border-0.shadow-sm {
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: none;
}
.card.border-0.shadow-sm .card-header {
    border-radius: 12px 12px 0 0;
    font-size: .95rem;
    font-weight: 600;
    color: #374151;
}
.card.border-0.shadow-sm .card-body { border-radius: 0 0 12px 12px; }

/* ── TABLES ──────────────────────────────── */
.table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}
.table tbody tr:hover td { background: #f8f9fa; }

/* ── BADGES (estados) ────────────────────── */
.badge-abierto    { background: #198754; color: #fff; }
.badge-enviado    { background: #fd7e14; color: #fff; }
.badge-listo      { background: #0dcaf0; color: #000; }
.badge-cobrado    { background: #6c757d; color: #fff; }
.badge-cancelado  { background: #dc3545; color: #fff; }
.badge-libre      { background: #198754; color: #fff; }
.badge-ocupada    { background: #dc3545; color: #fff; }
.badge-reservada  { background: #ffc107; color: #000; }

/* ── PRODUCT CARDS (Catalog) ─────────────── */
.product-card {
    border: 1px solid #e9ecef;
    border-radius: .75rem;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
    cursor: pointer;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.product-card .card-img-wrap {
    height: 140px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-card .card-img-wrap img {
    width: 100%; height: 100%; object-fit: cover;
}
.product-card .card-img-wrap .no-img {
    font-size: 3rem; opacity: .4;
}
.product-card .card-body { padding: .75rem; }
.product-card .prod-price {
    font-size: 1.15rem; font-weight: 700; color: #0d6efd;
}

/* ── MESAS (Floor Plan) ──────────────────── */
.floor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
}
.mesa-card {
    border-radius: .75rem;
    padding: 1rem .75rem;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
    display: block;
}
.mesa-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.mesa-card.libre     { background: #d1e7dd; border-color: #198754; color: #0a3622; }
.mesa-card.ocupada   { background: #f8d7da; border-color: #dc3545; color: #58151c; }
.mesa-card.reservada { background: #fff3cd; border-color: #ffc107; color: #664d03; }
.mesa-card .mesa-num  { font-size: 1.5rem; font-weight: 700; }
.mesa-card .mesa-name { font-size: .75rem; font-weight: 500; }
.mesa-card .mesa-cap  { font-size: .7rem; opacity: .7; }
.mesa-card .mesa-icon { font-size: 1.6rem; }

/* ── POS / TPV ───────────────────────────── */
.fullscreen-mode { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.pos-topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    flex-shrink: 0;
}
.pos-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Products panel */
.tpv-products-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8f9fa;
}
.tpv-cat-tabs {
    display: flex;
    gap: .35rem;
    padding: .6rem .75rem;
    overflow-x: auto;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
    scrollbar-width: thin;
}
.tpv-cat-tabs::-webkit-scrollbar { height: 4px; }
.tpv-cat-tabs::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

.cat-btn {
    flex-shrink: 0;
    padding: .3rem .85rem;
    border-radius: 2rem;
    border: 2px solid transparent;
    background: #f0f0f0;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.cat-btn:hover { background: #e0e7ff; }
.cat-btn.active { color: #fff; border-color: transparent; }

.tpv-product-grid {
    flex: 1;
    overflow-y: auto;
    padding: .75rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .6rem;
    align-content: start;
}

.tpv-product-btn {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: .65rem;
    padding: .65rem .5rem;
    text-align: center;
    cursor: pointer;
    transition: transform .1s, box-shadow .15s, border-color .15s;
    user-select: none;
    width: 100%;
    position: relative;
}
.tpv-product-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    border-color: #0d6efd;
}
.tpv-product-btn:active { transform: scale(.97); }
.tpv-product-btn .prod-emoji { font-size: 2rem; display: block; margin-bottom: .3rem; }
.tpv-product-btn .prod-name  { font-size: .78rem; font-weight: 600; line-height: 1.2; }
.tpv-product-btn .prod-price { font-size: .9rem; font-weight: 700; color: #0d6efd; margin-top: .2rem; }
.tpv-product-btn .prod-img   { width: 60px; height: 60px; object-fit: cover; border-radius: .5rem; margin-bottom: .3rem; }

/* Cart panel */
.tpv-cart-panel {
    width: 340px;
    min-width: 340px;
    background: #fff;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tpv-cart-header {
    padding: .55rem .75rem;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    background: #f8f9fa;
    flex-shrink: 0;
}
.tpv-cart-header.para-llevar-active {
    background: #fff3cd;
    border-bottom-color: #ffc107;
}
.tpv-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: .5rem;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .35rem;
    border-bottom: 1px solid #f0f0f0;
}
.cart-item-name  { font-size: .82rem; font-weight: 500; flex: 1; }
.cart-qty-ctrl   { display: flex; align-items: center; gap: .25rem; }
.cart-qty-btn    { width: 24px; height: 24px; border: 1px solid #dee2e6; border-radius: .35rem; background: #f8f9fa; font-size: .85rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cart-qty-btn:hover { background: #e0e0e0; }
.cart-qty        { font-size: .85rem; font-weight: 600; min-width: 18px; text-align: center; }
.cart-item-price { font-size: .85rem; font-weight: 600; color: #0d6efd; min-width: 52px; text-align: right; }
.cart-item-del   { color: #dc3545; cursor: pointer; font-size: 1rem; background: none; border: none; padding: 0 .1rem; }

.tpv-cart-totals {
    padding: .75rem 1rem;
    border-top: 1px solid #dee2e6;
    font-size: .875rem;
    flex-shrink: 0;
}
.tpv-cart-totals .total-row { display: flex; justify-content: space-between; margin-bottom: .2rem; }
.tpv-cart-totals .total-grand { font-size: 1.2rem; font-weight: 700; color: #0d6efd; }

.tpv-cart-actions {
    padding: .65rem .75rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex-shrink: 0;
}

/* ── COCINA ──────────────────────────────── */
.pos-body .kitchen-grid {
    width: 100%;
    min-height: 0;
}
.kitchen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    padding: .75rem;
    overflow-y: auto;
    align-content: start;
    flex: 1;
}
.kitchen-card { border-radius: .75rem; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.kitchen-card .k-header {
    padding: .6rem 1rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .9rem;
}
.kitchen-card.estado-enviado  .k-header { background: #ffc107; color: #000; }
.kitchen-card.estado-listo    .k-header { background: #198754; color: #fff; }
.kitchen-item { display: flex; align-items: center; padding: .45rem .9rem; border-bottom: 1px solid #f0f0f0; gap: .5rem; }
.kitchen-item:last-child { border-bottom: none; }
.kitchen-item .ki-qty  { font-weight: 700; font-size: .95rem; min-width: 24px; }
.kitchen-item .ki-name { flex: 1; font-size: .85rem; }
.kitchen-item .ki-badge { font-size: .7rem; }

/* ── NOTIFICACIÓN PEDIDO LISTO ───────────── */
@keyframes notifyPulse {
    0%,100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(25,135,84,.5); }
    50%      { transform: scale(1.12); box-shadow: 0 0 0 10px rgba(25,135,84,0); }
}
@keyframes notifySlide {
    from { opacity:0; transform: translateY(-18px); }
    to   { opacity:1; transform: translateY(0); }
}
@keyframes topBarAnim {
    0%   { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.notify-ready-card {
    border-radius: 1rem !important;
    animation: notifySlide .3s ease;
}
.notify-top-bar {
    height: 5px;
    background: linear-gradient(90deg, #198754, #20c997, #198754);
    background-size: 200% 100%;
    animation: topBarAnim 1.8s linear infinite;
}
.notify-bell-wrap {
    width: 52px;
    height: 52px;
    background: #d1e7dd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: notifyPulse 1.4s ease-in-out infinite;
}
.notify-bell-icon {
    font-size: 1.5rem;
    color: #198754;
}

/* ── LOGIN ───────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}
.login-card { width: 100%; max-width: 400px; border-radius: 1rem; border: none; }

/* Tabla pedidos recientes: texto centrado verticalmente */
.table-align-middle th,
.table-align-middle td {
    vertical-align: middle;
}
.table-align-middle td.col-estado {
    padding: 5px;
}

/* Botón táctil: área mínima para pantallas táctiles (≥44px) */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
    .main-content { margin-left: var(--sidebar-collapsed-width) !important; padding: 1rem; }
    body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-width) !important; }
    .sidebar { width: var(--sidebar-width); }
    body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
    .tpv-cart-panel { width: 260px; min-width: 260px; }
    .tpv-product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
