/* ===========================================================================
   Marketplace GFD — sistema de diseño (lenguaje visual JAPAM/SISCOM)
   Paleta: navy #0A2540 (chrome), azul #0284C7 (acción), grises slate.
   =========================================================================== */

:root {
    --brand-navy: #0A2540;
    --primary: #0284C7;
    --primary-hover: #0369A1;
    --primary-soft: #E0F2FE;

    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-soft: #eef2f6;

    --text: #1e293b;
    --heading: #0f2440;
    --muted: #64748b;

    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0ea5e9;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, .12);

    --sidebar-w: 240px;
}

html, body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, h4, h5, .app-brand-name {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    color: var(--heading);
    font-weight: 600;
}

h1 { font-size: 1.55rem; font-weight: 700; }
h2, .h5 { font-size: 1.05rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
code { color: #be185d; background: #fdf2f8; padding: .05rem .3rem; border-radius: 5px; font-size: .82em; }

/* ---------- App shell (sidebar + contenido) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0A2540 0%, #0B2E4D 100%);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
}

.app-brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: .5rem;
    padding: 1.1rem 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-brand-tag { font-size: .68rem; letter-spacing: .18em; color: #7dd3fc; font-weight: 600; padding-left: .15rem; }

/* Logo GFD: chip blanco sobre fondos oscuros (texto navy legible); nativo sobre blanco. */
.logo-chip { background: #fff; border-radius: 9px; padding: .4rem .6rem; display: inline-flex; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.logo-chip img { height: 26px; display: block; }
.brand-logo-lg { height: 44px; display: block; }
.login-aside .logo-chip img { height: 30px; }

.app-nav { flex: 1; padding: .75rem .6rem; overflow-y: auto; }
.app-nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #64748b; padding: .5rem .65rem .25rem; }
.app-nav-item {
    display: flex; align-items: center; gap: .7rem;
    padding: .58rem .7rem; margin: 2px 0;
    border-radius: var(--radius);
    color: #cbd5e1 !important; text-decoration: none !important;
    font-weight: 500; font-size: .9rem;
    transition: background .15s, color .15s;
}
.app-nav-item .ico { width: 1.25rem; text-align: center; font-size: 1.02rem; opacity: .9; }
.app-nav-item:hover { background: rgba(255,255,255,.06); color: #fff !important; }
.app-nav-item.active { background: var(--primary); color: #fff !important; box-shadow: 0 2px 8px rgba(2,132,199,.35); }

.app-user {
    display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1rem; border-top: 1px solid rgba(255,255,255,.08);
}
.app-user-avatar {
    width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
    background: var(--primary); color: #fff; display: grid; place-items: center;
    font-weight: 600; text-transform: uppercase;
}
.app-user-meta { flex: 1; min-width: 0; }
.app-user-name { color: #fff; font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user-role { color: #7dd3fc; font-size: .72rem; }
.app-logout {
    background: rgba(255,255,255,.08); border: none; color: #cbd5e1;
    width: 32px; height: 32px; border-radius: var(--radius); cursor: pointer; font-size: .95rem;
}
.app-logout:hover { background: var(--danger); color: #fff; }

.app-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.app-content { padding: 1.75rem 2rem; max-width: 1500px; }
.page-head { margin-bottom: 1.25rem; }
.page-head .lead, .page-sub { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }

/* ---------- Componentes (override Bootstrap a la identidad GFD) ---------- */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 1.25rem 1.4rem; }

.table { font-size: .85rem; color: var(--text); }
.table > thead > tr > th {
    background: #f8fafc; color: var(--muted);
    text-transform: uppercase; font-size: .7rem; letter-spacing: .04em; font-weight: 600;
    border-bottom: 1px solid var(--border); border-top: none; padding: .65rem .75rem;
    white-space: nowrap;
}
.table > tbody > tr > td { padding: .6rem .75rem; border-color: var(--border-soft); vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: #f8fafc; }

.btn { border-radius: var(--radius); font-weight: 500; font-size: .85rem; padding: .45rem .9rem; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { color: var(--primary); border-color: #bae6fd; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-link { color: var(--primary); }

.badge { font-weight: 600; border-radius: 9999px; padding: .3rem .6rem; font-size: .72rem; }
.text-bg-primary { background: var(--primary) !important; }
.text-bg-success { background: var(--success) !important; }
.text-bg-info    { background: #0891b2 !important; }
.text-bg-warning { background: var(--warning) !important; color: #fff !important; }
.text-bg-danger  { background: var(--danger) !important; }
.text-bg-dark    { background: var(--brand-navy) !important; }
.text-bg-secondary { background: #94a3b8 !important; }

.form-control, .form-select { border-radius: var(--radius); border-color: var(--border); font-size: .85rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,.12); }
.form-label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.form-label.small { font-size: .72rem; }

.alert { border-radius: var(--radius); border: none; border-left: 3px solid transparent; font-size: .87rem; }
.alert-danger { background: #fef2f2; color: #991b1b; border-left-color: var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left-color: var(--warning); }
.alert-success { background: #ecfdf5; color: #065f46; border-left-color: var(--success); }
.alert-info { background: var(--primary-soft); color: #075985; border-left-color: var(--info); }

/* KPI cards del dashboard */
.kpi { display: flex; align-items: center; gap: 1rem; }
.kpi-ico { width: 46px; height: 46px; border-radius: var(--radius-lg); display: grid; place-items: center; font-size: 1.3rem; background: var(--primary-soft); }
.kpi-val { font-size: 1.6rem; font-weight: 700; color: var(--heading); line-height: 1; font-family: 'Poppins', sans-serif; }
.kpi-lbl { color: var(--muted); font-size: .8rem; }

/* ---------- Tarjetas de canal (grid) ---------- */
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1rem; }
.ch-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); padding: 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .75rem;
    transition: box-shadow .15s, transform .15s;
}
.ch-card:hover { box-shadow: var(--shadow-md); }
.ch-card.is-on { border-left: 3px solid var(--success); }
.ch-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ch-code { font-family: 'Poppins', sans-serif; font-weight: 700; color: var(--heading); font-size: 1.05rem; }
.ch-name { font-size: .82rem; color: var(--muted); margin: -.5rem 0 0; }
.ch-stats { display: flex; gap: 1.25rem; padding: .5rem 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.ch-stat span { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ch-stat strong { font-size: .95rem; color: var(--heading); font-weight: 600; }
.ch-switches { display: flex; gap: 1.25rem; }
.ch-switches .form-check { margin: 0; min-height: auto; padding-left: 2.6rem; }
.ch-switches .form-check-label { font-size: .82rem; color: var(--text); }
.ch-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.ch-actions .btn { flex: 1 1 auto; }

.form-switch .form-check-input { width: 2.1rem; height: 1.1rem; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 3px rgba(2,132,199,.12); border-color: var(--primary); }

/* ---------- Login (split mitad-y-mitad) ---------- */
.login-bg {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: linear-gradient(165deg, #050D1A 0%, #0A2540 32%, #0C3D5E 62%, #0E7490 100%);
}
.login-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.login-aside {
    background: linear-gradient(160deg, #050D1A 0%, #0A2540 38%, #0C3D5E 72%, #0E7490 100%);
    color: #e2e8f0; padding: 3.5rem 4rem; display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.login-aside::after {
    content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px;
    border-radius: 50%; background: radial-gradient(circle, rgba(14,116,144,.45), transparent 70%);
}
.login-aside .app-brand-mark { width: 52px; height: 52px; flex: 0 0 52px; font-size: 1.5rem; border-radius: 13px; }
.login-aside-brand { display: flex; align-items: center; gap: .9rem; margin-bottom: 2.5rem; }
.login-aside-brand .name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.4rem; color: #fff; line-height: 1; }
.login-aside-brand .name small { display: block; font-size: .72rem; letter-spacing: .16em; color: #7dd3fc; font-weight: 500; margin-top: 2px; }
.login-aside h2 { color: #fff; font-size: 1.8rem; line-height: 1.2; margin-bottom: 1rem; max-width: 26ch; }
.login-aside p.tag { color: #cbd5e1; font-size: .95rem; max-width: 38ch; margin-bottom: 2rem; }
.login-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.login-features li { display: flex; align-items: center; gap: .65rem; font-size: .9rem; color: #e2e8f0; }
.login-features .chk { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; background: rgba(232,192,74,.18); color: #F2C94C; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.login-form-pane { background: #fff; display: grid; place-items: center; padding: 2rem; }
.login-form-inner { width: 100%; max-width: 360px; }
.login-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.4rem; }
.login-brand .app-brand-mark { width: 42px; height: 42px; flex: 0 0 42px; font-size: 1.25rem; }
.login-brand-name { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.15rem; color: var(--heading); line-height: 1.05; }
.login-brand-name small { display: block; font-size: .68rem; letter-spacing: .14em; color: var(--primary); font-weight: 500; }
.login-foot { color: var(--muted); font-size: .7rem; margin-top: 1.6rem; text-align: center; }
.login-logo-top { height: 38px; margin-bottom: 1.7rem; }
.login-form-inner .form-label { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; color: #94a3b8; margin-bottom: .4rem; font-weight: 600; }

/* Campo con icono + ojo */
.field { position: relative; }
.field > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; width: 18px; height: 18px; pointer-events: none; }
.field .form-control { padding-left: 2.7rem; height: 46px; background: #f8fafc; }
.field .form-control:focus { background: #fff; }
.field .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #94a3b8; padding: 7px; cursor: pointer; line-height: 0; border-radius: 6px; }
.field .eye:hover { color: var(--primary); background: #f1f5f9; }

.btn-login {
    background: var(--primary);
    border: none; color: #fff; font-weight: 600; height: 48px; border-radius: 10px;
    box-shadow: 0 6px 16px rgba(2,132,199,.22); transition: background .15s, box-shadow .15s; letter-spacing: .02em;
}
.btn-login:hover { background: #0369A1; box-shadow: 0 8px 20px rgba(2,132,199,.32); color: #fff; }
.btn-login:disabled { background: #9cc6e3; opacity: 1; box-shadow: none; }
.login-help { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 1.1rem; }
.login-help a { color: var(--primary); }

@media (max-width: 860px) { .login-split { grid-template-columns: 1fr; } .login-aside { display: none; } }

/* ---------- Base Blazor (plantilla) ---------- */
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.darker-border-checkbox.form-check-input { border-color: #929292; }

.blazor-error-boundary {
    background: #b32121; padding: 1rem 1rem 1rem 1rem; color: white; border-radius: var(--radius);
}
.blazor-error-boundary::after { content: "Ha ocurrido un error." }

#blazor-error-ui {
    color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1060;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
