/* ==========================================================================
   MEDIAMONO Demos — hoja de estilos única
   Secciones: Fuentes · Variables · Reset · Tipografía · Layout · Navbar ·
   Botones · Cards · KPI · Formularios · Tablas · Badges · Alertas · Auth ·
   Admin · Demo · Responsive
   ========================================================================== */

/* Fuentes */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

/* Variables */
:root {
    --bg: #0e0e0e;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --border: #2e2e2e;
    --text: #ffffff;
    --text-muted: #9a9a9a;
    --accent: #f2845f;
    --on-accent: #0e0e0e;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --chip-lime: #d7e86b;
    --chip-success-bg: #2c3a1e;
    --chip-success: #b9db6c;
    --positive: #6fcf73;
    --negative: #f26a6a;

    --fs-xl: 42px;
    --fs-lg: 32px;
    --fs-md: 20px;
    --fs-base: 14px;
    --fs-sm: 13px;

    --radius-card: 20px;
    --radius-icon: 14px;
    --radius-pill: 999px;
    --space: 8px;
    --gap: 16px;
    --pad: 20px;
}

/* Reset */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: var(--fs-base);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* Tipografía */
.title {
    font-size: var(--fs-xl);
    font-weight: 600;
    line-height: 1.1;
}

.card-title {
    font-size: var(--fs-md);
    font-weight: 600;
}

.label,
.muted {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.text-right {
    text-align: right;
}

/* Layout */
.shell {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: var(--gap) var(--gap) 96px;
    display: grid;
    gap: var(--gap);
}

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.row-between {
    justify-content: space-between;
}

.grow {
    flex: 1;
}

.stack {
    display: grid;
    gap: 12px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--gap);
    padding: 24px 0 8px;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Navbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    padding: 8px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-icon);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-icon);
    object-fit: cover;
}

.pill-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
}

.pill-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    white-space: nowrap;
}

.pill-link:hover {
    color: var(--text);
}

.pill-link.is-active {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.pill-link.is-active::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
}

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    font-weight: 600;
}

.role-switch {
    display: flex;
    gap: 4px;
    margin: 0;
}

/* Botones */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.button:hover {
    border-color: var(--text-muted);
}

.button-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.button-primary:hover {
    border-color: var(--accent);
    filter: brightness(1.08);
}

.button-danger {
    color: var(--negative);
}

.button-small {
    min-height: 32px;
    padding: 0 12px;
    font-size: var(--fs-sm);
}

.button-full {
    width: 100%;
}

.button.is-active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* Cards */
.card {
    padding: var(--pad);
    border-radius: var(--radius-card);
    background: var(--surface);
    display: grid;
    gap: var(--gap);
    align-content: start;
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-flush .card-header {
    padding: var(--pad) var(--pad) 0;
}

.empty {
    padding: 32px var(--pad);
    text-align: center;
    color: var(--text-muted);
}

/* KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 12px;
}

.kpi-card {
    display: grid;
    gap: 8px;
    padding: var(--pad);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.kpi-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-icon);
    background: var(--surface-2);
    color: var(--accent);
    font-weight: 700;
}

.kpi-value {
    font-size: var(--fs-lg);
    font-weight: 500;
    line-height: 1;
}

.kpi-delta-positive {
    color: var(--positive);
}

.kpi-delta-negative {
    color: var(--negative);
}

/* Formularios */
.form {
    display: grid;
    gap: var(--gap);
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-icon);
    background: var(--surface-2);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: var(--accent);
}

.field input[type="color"] {
    padding: 4px;
    cursor: pointer;
}

.field input[type="file"] {
    padding: 10px 16px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--gap);
}

.field-error {
    color: var(--negative);
    font-size: var(--fs-sm);
}

.check {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.check input {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-icon);
    background: var(--surface-2);
    cursor: pointer;
}

.option:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.option input {
    accent-color: var(--accent);
    margin-top: 4px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0;
}

.link-box {
    display: flex;
    gap: 8px;
}

.link-box input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-2);
}

/* Tablas */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    padding: 12px var(--pad);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 14px var(--pad);
    border-top: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--surface-2);
}

/* Badges */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    white-space: nowrap;
}

.chip-lime {
    border-color: var(--chip-lime);
    background: var(--chip-lime);
    color: var(--bg);
}

.chip-success {
    border-color: var(--chip-success-bg);
    background: var(--chip-success-bg);
    color: var(--chip-success);
}

.chip-danger {
    border-color: transparent;
    background: color-mix(in srgb, var(--negative) 18%, transparent);
    color: var(--negative);
}

/* Alertas */
.alert {
    padding: 12px var(--pad);
    border-radius: var(--radius-icon);
    background: var(--chip-success-bg);
    color: var(--chip-success);
}

.alert-warning {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Auth */
.auth-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--gap);
}

.auth-card {
    width: min(100%, 420px);
}

.auth-card-wide {
    width: min(100%, 520px);
    text-align: center;
}

.auth-card-wide .brand {
    justify-content: center;
}

/* Admin */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.is-activa {
    background: var(--positive);
}

.status-dot.is-vencida {
    background: var(--negative);
}

.catalog-pitch {
    max-width: 380px;
    color: var(--text-muted);
}

/* Demo */
.module-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.module-form .field input,
.module-form .field select {
    min-height: 40px;
}

.recent-list {
    display: grid;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px var(--pad);
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .title {
        font-size: var(--fs-lg);
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .pill-nav {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 10;
        justify-content: flex-start;
        overflow-x: auto;
        background: var(--surface-2);
    }

    .user-card .user-name {
        display: none;
    }

    .user-card {
        padding-left: 4px;
    }
}
