/* ============================================================
   ArguedasOne Post - Tema visual
   Paleta basada en la imagen: teal/verde/azul/slate
   ============================================================ */
:root {
    --brand-teal: #2980b9;        /* azul (primario / acento) */
    --brand-teal-dark: #1f6391;
    --brand-teal-light: #4aa3df;
    --green: #2980b9;             /* antes verde: ahora azul */
    --green-dark: #1f6391;
    --blue: #2980b9;
    --blue-dark: #1f6391;
    --slate: #2c3e50;             /* azul oscuro del menu */
    --slate-light: #34495e;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --row-selected: #d6eaf8;
    --row-hover: #eef5fb;
    --border: #e1e6eb;
    --text: #2c3e50;
    --muted: #7f8c9a;
    --danger: #e74c3c;
    --warning: #f39c12;
    --lime: #2980b9;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(44, 62, 80, .08), 0 1px 2px rgba(44, 62, 80, .06);
    --shadow-lg: 0 10px 30px rgba(44, 62, 80, .14);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.4rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout principal ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--slate);
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 1.1rem 1.2rem;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    letter-spacing: .3px;
}
.sidebar-brand small { display: block; font-size: .68rem; font-weight: 400; opacity: .85; }
.nav-section { padding: .5rem 1.2rem .3rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .6px; color: #93a5b8; margin-top: .4rem; }
.nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem 1.2rem;
    color: #d7dee6;
    font-size: .86rem;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(41,128,185,.28); color: #fff; border-left-color: var(--brand-teal-light); font-weight: 500; }
.nav-link .ico { width: 20px; text-align: center; font-size: 1rem; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 58px;
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.3rem;
    box-shadow: var(--shadow);
    position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 600; font-size: 1.02rem; }
.topbar .user { display: flex; align-items: center; gap: .8rem; font-size: .86rem; }
.topbar .avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-weight: 600;
}

.content { padding: 1.4rem; flex: 1; }
.footer { padding: .7rem 1.4rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); background: var(--surface); text-align: center; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 1.1rem 1.2rem; }
.card-header { padding: .7rem 1.2rem; background: var(--slate); color: #fff; border-bottom: 3px solid var(--brand-teal); font-weight: 600; letter-spacing: .3px; display: flex; justify-content: space-between; align-items: center; border-radius: var(--radius) var(--radius) 0 0; }
.card-header .muted { color: #cfe0e4; }
.card-header a { color: #fff; }
.card-header .btn-primary { background: #fff; color: var(--slate); }
.card-header .btn-outline { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.card-header .btn-outline:hover { background: rgba(255,255,255,.24); }
.card-header label { color: #fff; }

.grid { display: grid; gap: 1rem; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); border-top: 3px solid var(--brand-teal); }
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; }
.kpi.green { border-top-color: var(--green); }
.kpi.blue { border-top-color: var(--blue); }
.kpi.warn { border-top-color: var(--warning); }
.kpi.slate { border-top-color: var(--slate-light); }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: none; border-radius: 8px; padding: .5rem .95rem;
    font-size: .85rem; font-weight: 500; cursor: pointer; font-family: inherit;
    transition: filter .15s, transform .05s; color: #fff; background: var(--slate-light);
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-teal); }
.btn-green { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); }
.btn-danger { background: var(--danger); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); filter: none; }
.btn-sm { padding: .32rem .6rem; font-size: .78rem; }
.btn-lg { padding: .7rem 1.3rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Formularios ---------- */
.form-group { margin-bottom: .9rem; }
label { display: block; font-size: .8rem; font-weight: 500; margin-bottom: .3rem; color: var(--slate-light); }
.form-control, input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], select, textarea {
    width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 8px;
    font-size: .88rem; font-family: inherit; color: var(--text); background: #fff; outline: none;
}
.form-control:focus, input:focus, select:focus, textarea:focus { border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(41,128,185,.20); }
.form-row { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.validation-message, .field-validation-error { color: var(--danger); font-size: .78rem; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .85rem; }
table.data thead th { background: var(--slate-light); color: #fff; text-align: left; padding: .6rem .8rem; font-weight: 600; white-space: nowrap; }
table.data tbody td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
table.data tbody tr:hover { background: var(--row-hover); }
table.data tbody tr.selected { background: var(--row-selected); }
.text-end { text-align: right; }
.text-center { text-align: center; }

/* ---------- Insignias ---------- */
.badge { display: inline-block; padding: .18rem .55rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-green { background: #d6eaf8; color: var(--blue-dark); }
.badge-blue { background: #d6eaf8; color: var(--blue-dark); }
.badge-warn { background: #fdebd0; color: #b9770e; }
.badge-danger { background: #fadbd8; color: #a93226; }
.badge-slate { background: #e5e9ec; color: var(--slate); }

/* ---------- Utilidades ---------- */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; flex-wrap: wrap; gap: .8rem; }
.page-header h1 { color: var(--brand-teal); }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mb-2{margin-bottom:1rem}.p-4{padding:1.5rem}
.muted { color: var(--muted); }
.spacer { flex: 1; }
.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .85rem; }
.alert-success { background: #d6eaf8; color: var(--blue-dark); }
.alert-danger { background: #fadbd8; color: #a93226; }
.alert-info { background: #d6eaf8; color: var(--blue-dark); }
.stub-note { background: #fff; border: 1px dashed var(--brand-teal); border-radius: var(--radius); padding: 1.4rem; color: var(--slate-light); }

/* ---------- Punto de venta ---------- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 1rem; height: calc(100vh - 58px - 2.8rem); }
.pos-products { display: flex; flex-direction: column; min-height: 0; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .7rem; overflow-y: auto; padding: .3rem; }
.prod-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem; cursor: pointer; box-shadow: var(--shadow); transition: transform .06s, box-shadow .12s; }
.prod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-teal-light); }
.prod-thumb { width: 100%; height: 84px; border-radius: 8px; overflow: hidden; background: #f2f5f8; display: flex; align-items: center; justify-content: center; margin-bottom: .5rem; border: 1px solid var(--border); }
.prod-thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-thumb-ph { font-size: 2rem; font-weight: 700; color: var(--brand-teal-light); }
.prod-card .name { font-weight: 600; font-size: .82rem; margin-bottom: .3rem; min-height: 2.2em; }
.prod-card .price { color: var(--brand-teal-dark); font-weight: 700; }
.prod-card .stock { font-size: .72rem; color: var(--muted); }
.cart { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: var(--shadow); min-height: 0; }
.cart-head { background: var(--slate); color: #fff; padding: .7rem 1rem; border-radius: var(--radius) var(--radius) 0 0; font-weight: 600; }
.cart-items { flex: 1; overflow-y: auto; }
.cart-item { display: flex; align-items: center; gap: .4rem; padding: .5rem .8rem; border-bottom: 1px solid var(--border); }
.cart-item .ci-name { flex: 1; font-size: .82rem; }
.cart-item .ci-qty { width: 54px; }
.cart-total { padding: 1rem; border-top: 2px solid var(--border); }
.total-row { display: flex; justify-content: space-between; margin-bottom: .35rem; font-size: .9rem; }
.total-row.grand { font-size: 1.35rem; font-weight: 700; color: var(--brand-teal-dark); border-top: 1px solid var(--border); padding-top: .5rem; margin-top: .3rem; }

/* ---------- Tarjeta centrada (Error / Acceso denegado) ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-teal), var(--slate)); padding: 1rem; }
.login-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; overflow: hidden; }
.login-head { background: linear-gradient(135deg, var(--brand-teal-light), var(--brand-teal-dark)); color: #fff; padding: 1.8rem; text-align: center; }
.login-head h1 { font-size: 1.5rem; margin: 0; }
.login-head p { margin: .3rem 0 0; opacity: .9; font-size: .85rem; }
.login-body { padding: 1.8rem; }
.login-foot { text-align: center; padding: 0 1.8rem 1.5rem; color: var(--muted); font-size: .75rem; }

/* ---------- Login (estilo Instagram, dos paneles) ---------- */
.lg-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: #fafbfc;
}

/* Panel izquierdo: marca + empresa + seguridad */
.lg-brand {
    position: relative;
    color: #fff;
    background: linear-gradient(150deg, var(--brand-teal-dark) 0%, var(--brand-teal) 45%, #16324a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 3.5rem;
    overflow: hidden;
}
.lg-brand::after {
    content: "";
    position: absolute;
    width: 520px; height: 520px;
    right: -180px; top: -160px;
    background: radial-gradient(circle at center, rgba(255,255,255,.10), transparent 70%);
    border-radius: 50%;
}
.lg-brand-inner { position: relative; z-index: 1; max-width: 420px; width: 100%; }
.lg-logo {
    width: 68px; height: 68px; border-radius: 18px;
    background: rgba(255,255,255,.14);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; margin-bottom: 1.1rem;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.lg-brand-name { font-size: 2.3rem; font-weight: 700; margin: 0; letter-spacing: .5px; }
.lg-tagline { margin: .35rem 0 1.6rem; opacity: .9; font-size: 1rem; }

.lg-lema {
    font-size: 1.6rem; font-weight: 600; letter-spacing: .5px;
    margin: 0 0 1.6rem; padding-bottom: 1rem;
    position: relative;
}
.lg-lema::after {
    content: ""; position: absolute; left: 0; bottom: 0;
    width: 64px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.55);
}

.lg-secure {
    display: flex; align-items: center; gap: .9rem;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 12px;
    padding: 1rem 1.15rem;
}
.lg-secure-ico {
    font-size: 1.6rem; flex: none;
    width: 44px; height: 44px; border-radius: 11px;
    background: rgba(255,255,255,.12);
    display: flex; align-items: center; justify-content: center;
}
.lg-secure strong { font-size: 1rem; }
.lg-secure p { margin: .2rem 0 0; font-size: .85rem; opacity: .9; line-height: 1.35; }

/* Panel derecho: tarjeta de inicio de sesion */
.lg-panel {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2.5rem 1.5rem; gap: .9rem;
}
.lg-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    width: 100%; max-width: 380px;
    padding: 2.4rem 2.2rem 2rem;
    text-align: center;
}
.lg-card-logo {
    width: 56px; height: 56px; margin: 0 auto .7rem;
    border-radius: 15px;
    background: linear-gradient(150deg, var(--brand-teal-light), var(--brand-teal-dark));
    display: flex; align-items: center; justify-content: center; font-size: 1.7rem;
    box-shadow: var(--shadow);
}
.lg-card-brand { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.lg-card-sub { margin: .2rem 0 1.4rem; color: var(--muted); font-size: .88rem; }

.lg-field { margin-bottom: .7rem; text-align: left; }
.lg-field input {
    width: 100%; padding: .72rem .8rem;
    background: #fafbfc; border: 1px solid var(--border); border-radius: 9px;
    font-size: .92rem; transition: border-color .15s, box-shadow .15s;
}
.lg-field input:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(41,128,185,.16); background: #fff; }

.lg-remember { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 1.1rem; font-size: .84rem; color: var(--muted); }
.lg-remember input { width: auto; }
.lg-remember label { margin: 0; }

.lg-btn {
    width: 100%; padding: .78rem; border: none; border-radius: 9px; cursor: pointer;
    background: var(--brand-teal); color: #fff; font-size: 1rem; font-weight: 600; letter-spacing: .3px;
    transition: background .15s, transform .05s;
}
.lg-btn:hover { background: var(--brand-teal-dark); }
.lg-btn:active { transform: translateY(1px); }

.lg-secure-note { margin-top: 1.1rem; font-size: .76rem; color: var(--muted); }

.lg-card-alt { padding: 1rem 1.4rem; font-size: .85rem; color: var(--muted); }
.lg-foot { font-size: .78rem; color: var(--muted); text-align: center; }

@media (max-width: 860px) {
    .lg-page { grid-template-columns: 1fr; }
    .lg-brand { padding: 2.5rem 1.6rem; }
    .lg-brand-name { font-size: 1.9rem; }
    .lg-panel { padding: 2rem 1.2rem 3rem; }
}

/* ---------- Error UI Blazor ---------- */
#blazor-error-ui { background: var(--warning); color: #fff; bottom: 0; display: none; left: 0; padding: .7rem 1.2rem; position: fixed; width: 100%; z-index: 1000; box-shadow: 0 -1px 3px rgba(0,0,0,.2); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .6rem; }
#blazor-error-ui .reload { color: #fff; text-decoration: underline; }

/* ---------- Menú móvil (hamburguesa + cajón lateral) ---------- */
.topbar-left { display: flex; align-items: center; min-width: 0; }
.menu-toggle-cb { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.menu-toggle { display: none; }         /* oculto en escritorio */
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; margin-right: .5rem; flex: none;
        background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.35);
        border-radius: 8px; color: #fff; font-size: 1.3rem; cursor: pointer;
    }
    .sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 1200;
        transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 2px 0 16px rgba(0,0,0,.35);
    }
    .menu-toggle-cb:checked ~ .sidebar { transform: translateX(0); }
    .menu-toggle-cb:checked ~ .sidebar-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1100;
    }
    .topbar .title { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar .user span { display: none; }   /* oculta el nombre largo, deja avatar + Salir */
    .content { padding: 1rem .8rem; }
    .pos { grid-template-columns: 1fr; height: auto; }
}

/* En pantallas pequeñas, las cuadrículas de 2+ columnas se apilan (excepto los KPI) */
@media (max-width: 760px) {
    .grid:not(.grid-kpi) { grid-template-columns: 1fr !important; }
    .page-header { flex-wrap: wrap; gap: .5rem; }
    .page-header .toolbar { flex-wrap: wrap; }
    h1 { font-size: 1.15rem; }
}

.row-tot { display: flex; justify-content: space-between; align-items: baseline; padding: 3px 0; }
.row-tot span { color: var(--muted); }

/* ---------- Cuadro de confirmacion ---------- */
.cd-overlay { position: fixed; inset: 0; background: rgba(20,30,45,.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; animation: cdIn .12s ease-out; }
.cd-box { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; overflow: hidden; }
.cd-head { display: flex; align-items: center; gap: .6rem; padding: 1rem 1.2rem; font-weight: 600; font-size: 1.05rem; color: #fff; background: var(--brand-teal); }
.cd-head.cd-danger { background: var(--danger, #e74c3c); }
.cd-ico { font-size: 1.2rem; }
.cd-body { padding: 1.3rem 1.2rem; color: var(--text); font-size: .95rem; line-height: 1.5; }
.cd-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.2rem 1.2rem; }
@keyframes cdIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }

/* ---------- Paginador ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface); }
.pager-info { font-size: .8rem; color: var(--muted); }
.pager-btns { display: flex; gap: .3rem; flex-wrap: wrap; }
.pager-btns .btn { min-width: 34px; }

/* ---------- Campo de imagen (pegar/Picture) ---------- */
.pic-box { width: 100%; min-height: 150px; border: 2px dashed var(--brand-teal-light); border-radius: 10px; background: #fafbfc; display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; padding: .5rem; text-align: center; }
.pic-box:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(41,128,185,.18); background: #eef4fb; }
.pic-box img { max-width: 100%; max-height: 220px; object-fit: contain; border-radius: 6px; }
.pic-ph { color: var(--muted); font-size: .85rem; display: flex; flex-direction: column; gap: .4rem; align-items: center; }
