/* ==========================================================
   GLOBAL.CSS – Estilos base para TusVenta POS / Inventario Moderno
   Versión pro: más UX, títulos grandes, contraste mejorado
   ========================================================== */

/* ===============================
   0. Reset básico
   =============================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Escala tipográfica base un poco más grande */
html {
    font-size: 16px;
}

@media (min-width: 1280px) {
    html {
        font-size: 17px;
    }
}

html,
body {
    height: 100%;
    scroll-behavior: smooth;
}

/* Mejor legibilidad global */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
}

/* Scrollbar discreta en vistas con mucho contenido */
* {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #020617;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: #020617;
}

*::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 999px;
}


/* ===============================
   1. Paleta y variables de tema
   =============================== */

:root {
    /* Fondo y texto base – dark pero más claro y legible */
    --color-bg: #0f172a;           /* Azul marino */
    --color-bg-soft: #111827;      /* Fondo interno */
    --color-bg-card: #111827;      /* Tarjetas / dashboard */
    --color-surface: #0b1220;      /* Superficies (paneles) */

    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-border: #1f2937;

    /* Paleta principal */
    --color-primary: #2563eb;           /* Azul principal */
    --color-primary-soft: #1d4ed8;
    --color-primary-bg-subtle: #1d2951;

    /* Turquesa secundario */
    --color-secondary: #14b8a6;
    --color-secondary-soft: #0d9488;
    --color-secondary-bg-subtle: #05313a;

    /* Amarillo acento */
    --color-accent: #facc15;
    --color-accent-soft: #eab308;
    --color-accent-bg-subtle: #43320a;

    /* Rojo alertas */
    --color-danger: #ef4444;
    --color-danger-soft: #b91c1c;
    --color-danger-bg-subtle: #451016;

    /* Verde éxito */
    --color-success: #22c55e;
    --color-success-soft: #15803d;
    --color-success-bg-subtle: #05301f;

    /* Tokens de diseño */
    --radius-sm: 0.35rem;
    --radius-md: 0.6rem;
    --radius-lg: 1rem;
    --radius-pill: 999px;

    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.85);
    --shadow-subtle: 0 10px 24px rgba(15, 23, 42, 0.65);

    --transition-fast: 0.12s ease-out;
    --transition-normal: 0.18s ease-out;
}

/* Respeta usuarios con “reducir movimiento” */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* ===============================
   2. Body y estructura base
   =============================== */

body {
    background:
        radial-gradient(circle at top, #1e293b 0, #0b1220 45%, #020617 100%);
    color: var(--color-text);
}

/* Contenedor principal de la app */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    padding: 1.1rem;
}

.app-container {
    max-width: 1320px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .app-main {
        padding: 2rem 1.6rem 1.6rem;
    }

    .app-container {
        max-width: 1360px;
    }
}


/* ===============================
   3. Layout específico para POS
   =============================== */

.pos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.2rem;

    background: linear-gradient(115deg, #0b1220, #020617, #111827);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(15, 23, 42, 0.9);
}

.pos-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pos-header-title {
    font-size: 1.8rem;          /* MÁS GRANDE PARA VER FÁCIL */
    font-weight: 600;
}

.pos-header-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
}

.pos-header-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(260px, 0.95fr);
    gap: 1.1rem;
}

@media (max-width: 960px) {
    .pos-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .pos-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Panel genérico */
.card {
    background: linear-gradient(145deg, var(--color-bg-soft), #1f2937);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.pos-totals-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}


/* ===============================
   4. Títulos y texto (más grandes)
   =============================== */

h1, .title-xl {
    font-size: 2.2rem;          /* título principal grande */
    font-weight: 600;
    margin-bottom: 0.6rem;
}

h2, .title-lg {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
}

h3, .title-md {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.text-accent {
    color: var(--color-accent);
}

.text-sm {
    font-size: 0.92rem;
}

.text-xs {
    font-size: 0.82rem;
}


/* ===============================
   5. Badges
   =============================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-pill);
    font-size: 0.83rem;
    font-weight: 500;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.18);
    border-color: rgba(37, 99, 235, 0.6);
    color: #bfdbfe;
}

.badge-secondary {
    background: rgba(20, 184, 166, 0.18);
    border-color: rgba(20, 184, 166, 0.6);
    color: #a5f3fc;
}

.badge-warning {
    background: rgba(250, 204, 21, 0.12);
    border-color: rgba(250, 204, 21, 0.55);
    color: #facc15;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(248, 113, 113, 0.6);
    color: #fecaca;
}


/* ===============================
   6. Botones
   =============================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;

    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    padding: 0.7rem 1.4rem;

    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;

    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        border-color var(--transition-fast);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:active {
    transform: scale(0.97);
}

/* Focus visible accesible */
.btn:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.9);
    outline-offset: 2px;
}

/* Botón principal (azul + turquesa) */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #f9fafb;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.6);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-soft), var(--color-secondary-soft));
}

/* Botón secundario (turquesa) */
.btn-secondary {
    background: rgba(20, 184, 166, 0.18);
    border-color: rgba(20, 184, 166, 0.6);
    color: #a5f3fc;
}

.btn-secondary:hover {
    background: rgba(20, 184, 166, 0.32);
}

/* Botón éxito (verde) */
.btn-success {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.7);
    color: #bbf7d0;
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.3);
}

/* Botón advertencia (amarillo) */
.btn-warning {
    background: rgba(250, 204, 21, 0.18);
    border-color: rgba(250, 204, 21, 0.75);
    color: #facc15;
}

.btn-warning:hover {
    background: rgba(250, 204, 21, 0.28);
}

/* Botón peligro (rojo) */
.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), var(--color-danger-soft));
    color: #fee2e2;
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.6);
}

.btn-danger:hover {
    filter: brightness(1.05);
}

/* Botón fantasma */
.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover {
    background: rgba(148, 163, 184, 0.16);
}

.btn-block {
    width: 100%;
}


/* ===============================
   7. Inputs, selects y campos
   =============================== */

.input,
select,
textarea {
    width: 100%;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    padding: 0.6rem 1rem;
    font-size: 0.96rem;
    outline: none;
    background: rgba(15, 23, 42, 0.96);
    color: var(--color-text);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background-color var(--transition-fast);
    min-height: 2.5rem;
}

.input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.75);
}

.input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 1px rgba(37, 99, 235, 0.9),
        0 0 0 6px rgba(37, 99, 235, 0.22);
    background: #020617;
}

.input-sm {
    font-size: 0.88rem;
    padding: 0.4rem 0.8rem;
    min-height: 2.1rem;
}

/* Icono dentro de input (ej: lupa) */
.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 2.4rem;
}

.input-with-icon-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}


/* ===============================
   8. Tablas
   =============================== */

.table-wrapper {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: radial-gradient(circle at top, #111827 0, #020617 60%);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(31, 41, 55, 0.85);
}

/* Scroll horizontal en móvil */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: linear-gradient(90deg, #020617, #111827);
}

th,
td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
    text-align: left;
    white-space: nowrap;
}

th {
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}

th[data-col="actions"],
td[data-col="actions"] {
    text-align: center;
}

tbody tr:hover {
    background: rgba(15, 23, 42, 0.9);
}

tr.is-active {
    background: rgba(37, 99, 235, 0.2);
}


/* ===============================
   9. Panel de totales (POS)
   =============================== */

.pos-totals {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pos-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: var(--color-text-muted);
}

.pos-total-row strong {
    color: var(--color-text);
}

/* Monto principal bien grande */
.pos-total-main {
    margin-top: 0.5rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.55);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.pos-total-main-label {
    font-size: 1.05rem;
    color: var(--color-accent-soft);
}

.pos-total-main-value {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--color-accent);
}


/* ===============================
   10. Panel principal (index.php)
   =============================== */

.panel-card {
    background: linear-gradient(135deg, var(--color-bg-soft), #1f2937);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 1.5rem 1.7rem 1.6rem;
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.panel-header h1 {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.panel-header p {
    font-size: 0.98rem;
    color: var(--color-text-muted);
}

.session-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.86rem;
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1.3fr);
    gap: 1.1rem;
}

@media (max-width: 960px) {
    .panel-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.module-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;

    background: linear-gradient(160deg, #152238, #0f172a);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(37, 99, 235, 0.6);
    padding: 1.05rem 1.15rem;

    display: flex;
    flex-direction: column;
    gap: 0.4rem;

    transition:
        transform var(--transition-normal),
        box-shadow var(--transition-normal),
        border-color var(--transition-normal),
        background var(--transition-normal);
}

.module-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.23), transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.98);
    border-color: rgba(56, 189, 248, 0.9);
}

.module-card:hover::before {
    opacity: 1;
}

.module-card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.module-card-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.module-card-link {
    margin-top: 0.5rem;
}

.module-card-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;

    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;

    padding: 0.3rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(59, 130, 246, 0.85);

    background: rgba(37, 99, 235, 0.14);
    color: #bfdbfe;

    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.module-card-link a:hover {
    background: rgba(37, 99, 235, 0.26);
    border-color: rgba(56, 189, 248, 0.95);
    transform: translateY(-1px);
}

.panel-aside-card {
    background: linear-gradient(145deg, #020617, #0b1220);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(31, 41, 55, 0.95);
    padding: 1.05rem 1.15rem;
    box-shadow: var(--shadow-soft);
}

.card-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-section-subtitle {
    font-size: 0.86rem;
    color: var(--color-text-muted);
    margin-bottom: 0.7rem;
}

.status-list {
    list-style: none;
    margin: 0 0 0.8rem 0;
    font-size: 0.82rem;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
}

.status-left {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
}

/* Sutil animación de pulso para estados OK */
@keyframes statusPulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.status-dot--ok {
    background: var(--color-success);
    animation: statusPulse 1.8s infinite;
}

.status-dot--warn {
    background: var(--color-accent-soft);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.7);
}

.status-dot--error {
    background: var(--color-danger);
    box-shadow: 0 0 8px rgba(248, 113, 113, 0.8);
}

.status-label {
    color: var(--color-text);
}

.status-value {
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.api-hint {
    margin-top: 0.45rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(55, 65, 81, 0.95);
    font-size: 0.82rem;
}

.api-hint-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(75, 85, 99, 0.95);
    margin-top: 0.25rem;
    display: inline-flex;
    max-width: 100%;
    overflow-x: auto;
}

.footer-note {
    margin-top: 0.7rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    opacity: 0.9;
}

.panel-card a {
    text-decoration: none;
}

.panel-card a:hover {
    text-decoration: none;
}


/* ===============================
   11. Alertas y mensajes
   =============================== */

.alert {
    border-radius: var(--radius-md);
    padding: 0.7rem 0.95rem;
    font-size: 0.92rem;
    margin-bottom: 0.7rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert strong {
    font-weight: 600;
}

.alert-info {
    background: var(--color-secondary-bg-subtle);
    border: 1px solid rgba(45, 212, 191, 0.8);
    color: #ccfbf1;
}

.alert-success {
    background: var(--color-success-bg-subtle);
    border: 1px solid rgba(52, 211, 153, 0.8);
    color: #bbf7d0;
}

.alert-error {
    background: var(--color-danger-bg-subtle);
    border: 1px solid rgba(248, 113, 113, 0.95);
    color: #fecaca;
}

.alert-warning {
    background: var(--color-accent-bg-subtle);
    border: 1px solid rgba(250, 204, 21, 0.9);
    color: #fef9c3;
}


/* ===============================
   12. Utilidades de layout
   =============================== */

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 0.75rem; }
.mt-lg { margin-top: 1.1rem; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Accesibilidad: solo para texto oculto a vista pero no a lectores */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===============================
   13. Ajustes responsive finos
   =============================== */

@media (max-width: 640px) {
    .panel-card,
    .card,
    .pos-header {
        padding: 1rem 1rem;
    }

    h1, .title-xl {
        font-size: 1.9rem;
    }

    .pos-header-title {
        font-size: 1.6rem;
    }

    table {
        font-size: 0.92rem;
    }
}
