/* ============================================
   POS DIGITAL TAME - Estilos del POS (Empresas)
   ============================================
   El POS usa una identidad propia (verde) para
   diferenciarse del panel-control del superadmin.
*/

:root {
    /* Color principal del POS - verde "comercial" */
    --pos-primary: #16a34a;
    --pos-primary-dark: #15803d;
    --pos-primary-light: #f0fdf4;

    /* Sidebar */
    --pos-sidebar-width: 260px;
    --pos-sidebar-bg: #1a1d24;
    --pos-sidebar-text: #cbd5e1;
    --pos-sidebar-text-active: #ffffff;
    --pos-sidebar-hover: rgba(255,255,255,.06);
    --pos-sidebar-active: var(--pos-primary);

    /* Topbar */
    --pos-topbar-height: 68px;
    --pos-topbar-bg: #ffffff;

    /* Contenido */
    --pos-content-bg: #f5f7fb;
}

body.pos-body {
    background: var(--pos-content-bg);
    font-family: var(--pdt-font);
    color: var(--pdt-text);
}

/* ============================================
   LOGIN
   ============================================ */
.pos-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at top left, rgba(22, 163, 74, .12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(13, 110, 253, .08) 0%, transparent 50%),
        linear-gradient(180deg, #f5f7fb 0%, #e9ecef 100%);
}

.pos-login-card {
    background: #fff;
    border-radius: var(--pdt-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .12);
    width: 100%;
    max-width: 460px;
    overflow: hidden;
}

.pos-login-header {
    background: linear-gradient(135deg, var(--pos-primary) 0%, var(--pos-primary-dark) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.pos-login-logo {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, .15);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: .75rem;
}

.pos-login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .25rem;
}

.pos-login-subtitle {
    font-size: .9rem;
    opacity: .9;
    margin: 0;
}

.pos-login-body {
    padding: 2rem;
}

/* Botón principal verde */
.btn-pos-primary {
    background: var(--pos-primary);
    border-color: var(--pos-primary);
    color: #fff;
    font-weight: 600;
}
.btn-pos-primary:hover, .btn-pos-primary:focus {
    background: var(--pos-primary-dark);
    border-color: var(--pos-primary-dark);
    color: #fff;
}

/* ============================================
   SIDEBAR
   ============================================ */
.pos-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--pos-sidebar-width);
    background: var(--pos-sidebar-bg);
    color: var(--pos-sidebar-text);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}

.pos-sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: .75rem;
}

.pos-sidebar-logo {
    width: 38px;
    height: 38px;
    background: var(--pos-primary);
    color: #fff;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pos-sidebar-brand {
    color: #fff;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    font-size: .95rem;
}

.pos-sidebar-brand small {
    display: block;
    font-weight: 400;
    font-size: .75rem;
    color: var(--pos-sidebar-text);
    margin-top: 2px;
}

.pos-sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.pos-sidebar-section {
    padding: 1rem 1.5rem .35rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(203,213,225,.5);
}

.pos-sidebar-section:first-child {
    padding-top: 0;
}

.pos-sidebar-item {
    margin: 0;
}

.pos-sidebar-link {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .65rem 1.5rem;
    color: var(--pos-sidebar-text);
    text-decoration: none;
    font-size: .92rem;
    transition: all .15s ease;
    border-left: 3px solid transparent;
}

.pos-sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.pos-sidebar-link:hover {
    background: var(--pos-sidebar-hover);
    color: var(--pos-sidebar-text-active);
}

.pos-sidebar-link.active {
    background: rgba(22, 163, 74, .15);
    color: var(--pos-sidebar-text-active);
    border-left-color: var(--pos-primary);
    font-weight: 600;
}

.pos-sidebar-link[aria-disabled="true"] {
    opacity: .55;
    pointer-events: none;
}

.pos-sidebar-link .badge {
    margin-left: auto;
    font-size: .65rem;
    padding: .25rem .4rem;
}

.pos-sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.06);
    color: rgba(203,213,225,.5);
    font-size: .75rem;
    line-height: 1.4;
}

.pos-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1030;
}

.pos-sidebar-backdrop.is-visible {
    display: block;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.pos-layout {
    min-height: 100vh;
}

.pos-main {
    margin-left: var(--pos-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}

/* === Sidebar colapsado (oculto temporalmente en desktop) ===
   El usuario puede colapsar el sidebar para ganar espacio horizontal.
   Esto solo aplica en desktop (>= 992px). En móvil, el sidebar funciona
   diferente (translateX que aparece como overlay).
   La clase 'pos-sidebar-collapsed' se aplica en <body> para que el selector
   funcione sin importar la estructura HTML interna. */
@media (min-width: 992px) {
    body.pos-sidebar-collapsed .pos-sidebar {
        transform: translateX(-100%);
    }
    body.pos-sidebar-collapsed .pos-main {
        margin-left: 0;
    }
}

/* Animación normal del sidebar */
.pos-sidebar {
    transition: transform 0.2s ease;
}

.pos-content {
    padding: 1.5rem;
    flex: 1;
}

/* ============================================
   TOPBAR
   ============================================ */
.pos-topbar {
    height: var(--pos-topbar-height);
    background: var(--pos-topbar-bg);
    border-bottom: 1px solid var(--pdt-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.pos-topbar-toggle {
    background: transparent;
    border: 1px solid transparent;
    color: var(--pdt-text);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.pos-topbar-toggle:hover {
    background: var(--pdt-bg-soft, #f1f5f9);
    border-color: var(--pdt-border, #e2e8f0);
}
.pos-topbar-toggle:active {
    transform: scale(0.95);
}

.pos-topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.pos-topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pos-user-dropdown {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: transparent;
    border: 1px solid var(--pdt-border);
    border-radius: var(--pdt-radius);
    padding: .35rem .75rem;
    transition: all .15s ease;
}

.pos-user-dropdown:hover {
    border-color: var(--pos-primary);
    background: var(--pos-primary-light);
}

.pos-user-avatar {
    width: 34px;
    height: 34px;
    background: var(--pos-primary);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .85rem;
}

.pos-user-info {
    text-align: left;
}

.pos-user-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--pdt-text);
    line-height: 1.1;
}

.pos-user-role {
    font-size: .72rem;
    color: var(--pdt-text-muted);
    line-height: 1.1;
}

/* ============================================
   PAGE HEADER y CARDS (reutilizamos del admin)
   ============================================ */
.pos-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pos-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--pdt-text);
}

.pos-page-subtitle {
    color: var(--pdt-text-muted);
    margin: .25rem 0 0;
    font-size: .9rem;
}

.pos-card {
    background: #fff;
    border: 1px solid var(--pdt-border);
    border-radius: var(--pdt-radius);
    overflow: hidden;
}

.pos-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pdt-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #fafbfc;
}

.pos-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--pdt-text);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.pos-card-title i {
    color: var(--pos-primary);
}

.pos-card-body {
    padding: 1.25rem;
}

.pos-card-body.compact {
    padding: 0;
}

/* ============================================
   MÉTRICAS
   ============================================ */
.pos-metric-card {
    background: #fff;
    border: 1px solid var(--pdt-border);
    border-radius: var(--pdt-radius);
    padding: 1.25rem;
    height: 100%;
    transition: all .15s ease;
}

.pos-metric-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.pos-metric-label {
    font-size: .8rem;
    color: var(--pdt-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}

.pos-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: .25rem 0;
    color: var(--pdt-text);
}

.pos-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.pos-metric-icon.success {
    background: rgba(22, 163, 74, .12);
    color: var(--pos-primary);
}

.pos-metric-icon.primary {
    background: rgba(13, 110, 253, .12);
    color: var(--pdt-primary);
}

.pos-metric-icon.warning {
    background: rgba(245, 158, 11, .12);
    color: #f59e0b;
}

.pos-metric-icon.danger {
    background: rgba(220, 38, 38, .12);
    color: #dc2626;
}

.pos-metric-icon.info {
    background: rgba(14, 165, 233, .12);
    color: #0ea5e9;
}

.pos-metric-extra {
    font-size: .82rem;
    color: var(--pdt-text-muted);
    margin-top: .5rem;
}

/* ============================================
   ESTADO VACÍO
   ============================================ */
.pos-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--pdt-text-muted);
}

.pos-empty-state i {
    font-size: 3rem;
    opacity: .35;
    display: block;
    margin-bottom: .75rem;
}

/* ============================================
   STATUS PILLS (reutilizables)
   ============================================ */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
}

.status-pill.success { background: #dcfce7; color: #15803d; }
.status-pill.warning { background: #fef3c7; color: #92400e; }
.status-pill.danger  { background: #fee2e2; color: #991b1b; }
.status-pill.info    { background: #dbeafe; color: #1e40af; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .pos-sidebar {
        transform: translateX(-100%);
    }
    .pos-sidebar.is-open {
        transform: translateX(0);
    }
    .pos-main {
        margin-left: 0;
    }
    .pos-content {
        padding: 1rem;
    }
}

/* ============================================
   SELECT2 - Ajustes para que funcione bien con
   modales de Bootstrap (z-index correcto)
   ============================================ */

/* El dropdown del Select2 debe estar siempre por encima del modal */
.select2-container--open {
    z-index: 9999 !important;
}

/* Cuando un dropdown de Select2 vive dentro de un modal abierto,
   ajustar para que no se "escape" visualmente */
.modal.show .select2-container {
    z-index: 1056; /* Modal de Bootstrap usa z-index 1055 */
}

/* Mejorar altura del Select2 para que coincida con form-control */
.select2-container--bootstrap-5 .select2-selection {
    min-height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: 1.5;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

/* Mejor visibilidad de la X de "allow-clear" */
.select2-container--bootstrap-5 .select2-selection__clear {
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Para selects pequeños (sm) dentro de tablas */
.form-select-sm + .select2-container--bootstrap-5 .select2-selection {
    min-height: calc(1.5em + 0.5rem + 2px);
    font-size: 0.875rem;
}

/* ============================================
   NOTIFICACIONES (campanita del topbar)
   ============================================ */
.pos-bell-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--bs-secondary-color);
    transition: all 0.15s ease;
    border-radius: 8px;
}
.pos-bell-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--pos-primary);
}

.pos-bell-dropdown {
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.pos-bell-item {
    color: inherit;
    transition: background-color 0.1s ease;
}
.pos-bell-item:hover {
    background-color: #f8fafc;
}
