/* ---------------------------------------------------------------
   Gestor de Hosting — tematizado con el Sistema de Diseño de HyperApp
   (paleta y tokens de docs/07_SISTEMA_DISENO). Sin dependencias externas.
   --------------------------------------------------------------- */
:root {
    /* Paleta HyperApp */
    --primary-700: #1f4e79;
    --primary-500: #2e6da4;
    --primary-100: #d9e2f3;
    --success-500: #14a38b;
    --warning-500: #e8a33d;
    --danger-500:  #d64545;
    --ai-accent:   #6b4eff;

    --gray-900: #1a1a1a;
    --gray-600: #595959;
    --gray-400: #bfbfbf;
    --gray-200: #e6e6e6;
    --gray-100: #f2f2f2;
    --white:    #ffffff;

    /* Alias semánticos usados por los componentes */
    --bg:       var(--gray-100);
    --surface:  var(--white);
    --border:   #e3e6ea;
    --text:     var(--gray-900);
    --muted:    var(--gray-600);
    --primary:  var(--primary-700);

    --radius:  8px;
    --radius-lg: 16px;
    --shadow:  0 1px 2px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .12);
    --font: 'Inter', system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
}

a { color: var(--primary-500); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Barra superior (azul HyperApp) --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .8rem 1.5rem;
    background: var(--primary-700);
    color: var(--white);
    box-shadow: var(--shadow-md);
}
.topbar__brand a { display: inline-flex; align-items: center; }
.topbar__brand a:hover { text-decoration: none; }
.topbar__logo { height: 30px; width: auto; display: block; }
.topbar__nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.topbar__nav a { color: rgba(255, 255, 255, .82); font-weight: 500; font-size: .95rem; }
.topbar__nav a:hover { color: var(--white); text-decoration: none; }

/* --- Contenedor --- */
.container {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 1.5rem; margin: 0; color: var(--primary-700); }

.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .85rem; }
.strong { font-weight: 600; }

/* --- Alertas / flash --- */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: .95rem;
}
.alert--success { background: #d7f2ec; color: #0c7a67; border-color: #a9e3d7; }
.alert--error   { background: #fbe3e3; color: #b13636; border-color: #f3c4c4; }
.alert--info    { background: var(--primary-100); color: var(--primary-700); border-color: #bcd0ea; }

/* --- Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-400);
    background: var(--white);
    color: var(--gray-900);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: filter .12s, background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary-700); border-color: var(--primary-700); color: var(--white); }
.btn--primary:hover { background: var(--primary-500); border-color: var(--primary-500); filter: none; }
.btn--danger { background: var(--white); border-color: #eab0b0; color: var(--danger-500); }
.btn--danger:hover { background: #fbe3e3; filter: none; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--gray-100); filter: none; }
.btn--sm { padding: .3rem .6rem; font-size: .85rem; }
.btn--block { width: 100%; justify-content: center; }
.inline { display: inline; }

/* --- Toolbar de búsqueda (legado) --- */
.toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.toolbar input[type="search"] {
    flex: 1;
    padding: .55rem .8rem;
    border: 1px solid var(--gray-400);
    border-radius: var(--radius);
    font: inherit;
}

/* --- Panel de filtros --- */
.filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .75rem 1rem;
    align-items: end;
}
.filters__field { display: flex; flex-direction: column; gap: .3rem; }
.filters__field > span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.filters__field input,
.filters__field select {
    padding: .5rem .6rem;
    border: 1px solid var(--gray-400);
    border-radius: var(--radius);
    font: inherit;
    background: var(--white);
    color: var(--text);
}
.filters__field input:focus,
.filters__field select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(46, 109, 164, .15);
}
.filters__actions { display: flex; gap: .5rem; align-items: flex-end; }
.filters__hint { margin: .7rem 0 0; font-size: .8rem; color: var(--muted); }
.result-summary {
    margin: 0 0 1rem;
    padding: .6rem .9rem;
    background: var(--primary-100);
    border: 1px solid #bcd0ea;
    border-radius: var(--radius);
    color: var(--primary-700);
    font-size: .92rem;
}

/* --- Barra de notificación --- */
.notify-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--primary-100);
    border: 1px solid #bcd0ea;
    border-radius: var(--radius);
    padding: .7rem .9rem;
    margin-bottom: .9rem;
}

/* --- Tabla --- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
}
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td {
    padding: .7rem .85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    white-space: nowrap;
}
.table thead th {
    background: #f7f9fc;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--primary-700);
}
.table .num { text-align: right; }
.table .check { width: 34px; text-align: center; }
.table .check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary-700); }
.table thead th .th-sort,
.table thead th a.th-sort {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.th-sort:hover { color: var(--primary-500); text-decoration: underline; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f7f9fc; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: .25rem; }
.table td.is-red   { color: var(--danger-500); font-weight: 600; }
.table td.is-amber { color: var(--warning-500); font-weight: 600; }

/* La columna de dominio puede partir línea: evita el scroll horizontal. */
.table .col-dominio {
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 130px;
}

/* --- Chips de estado (redondeados, estilo HyperApp) --- */
.badge {
    display: inline-block;
    padding: 2px .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-600);
}
.badge.is-green, .badge--green { background: #d7f2ec; color: var(--success-500); }
.badge.is-amber, .badge--amber { background: #fdf0dd; color: var(--warning-500); }
.badge.is-red,   .badge--red   { background: #fbe3e3; color: var(--danger-500); }
.badge.is-blue,  .badge--blue  { background: var(--primary-100); color: var(--primary-700); }
.badge.is-gray  { background: var(--gray-100); color: var(--gray-600); }

.empty { color: var(--muted); padding: 2rem; text-align: center; }

/* --- Formularios --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.25rem;
}
.form-narrow { max-width: 460px; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field--wide { grid-column: 1 / -1; }
.field__label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
    padding: .55rem .7rem;
    border: 1px solid var(--gray-400);
    border-radius: var(--radius);
    font: inherit;
    background: var(--white);
    color: var(--text);
    resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(46, 109, 164, .15);
}
/* Campo de fecha con botón para limpiar */
.date-input { display: flex; gap: .4rem; align-items: center; }
.date-input input { flex: 1; }
.date-clear {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-400);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    line-height: 1;
}
.date-clear:hover { background: #fbe3e3; border-color: #eab0b0; color: var(--danger-500); }

.form-section {
    font-size: 1rem;
    margin: 1.25rem 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--border);
    color: var(--primary-700);
}
.form-section:first-child { margin-top: 0; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: .75rem;
    margin-top: .5rem;
}

/* Filas de edición de planes */
.plan-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.plan-row input[type="text"] { flex: 1; min-width: 160px; }
.plan-row input, .plan-row select {
    padding: .5rem .65rem;
    border: 1px solid var(--gray-400);
    border-radius: var(--radius);
    font: inherit;
}
.plan-item {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.plan-item:last-child { border-bottom: none; }
.plan-item .plan-row { flex: 1; }
.plan-uso { white-space: nowrap; }

/* --- Login --- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    gap: 1.75rem;
    padding: 1.5rem;
    background: linear-gradient(160deg, var(--primary-700) 0%, var(--primary-500) 100%);
}
.auth__logo { height: 52px; width: auto; }
.auth__card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
}
.auth__title { margin: 0 0 .25rem; font-size: 1.4rem; text-align: center; color: var(--primary-700); }
.auth__subtitle { margin: 0 0 1.5rem; color: var(--muted); text-align: center; }
.auth .field { margin-bottom: 1rem; }

/* --- Errores --- */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 3rem; margin: 0 0 .5rem; color: var(--primary-700); }
.error-page p { color: var(--muted); margin-bottom: 1.5rem; }

/* --- Pie --- */
.footer {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    padding: 2rem 1rem;
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; }
}
