/* ============================================================
   HostPanel Pro — Estilos principales
   ============================================================ */

:root {
    --brand:       #2563eb;
    --brand-dark:  #1d4ed8;
    --brand-light: #eff6ff;
    --success:     #16a34a;
    --warning:     #d97706;
    --danger:      #dc2626;
    --info:        #0891b2;

    --bg:          #f8fafc;
    --surface:     #ffffff;
    --border:      #e2e8f0;
    --text:        #0f172a;
    --text-muted:  #64748b;
    --sidebar-w:   240px;
    --radius:      10px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

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

/* ── Página de autenticación ────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.auth-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-container--wide { max-width: 680px; }

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand .brand-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: .5rem;
}

.auth-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.auth-brand p {
    color: var(--text-muted);
    font-size: .875rem;
}

.auth-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .875rem;
    color: var(--text-muted);
    display: flex;
    gap: .75rem;
    justify-content: center;
}

/* ── Panel con sidebar ──────────────────────────────────────── */
.panel-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: #0f172a;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon { font-size: 1.25rem; }

.sidebar-menu {
    list-style: none;
    padding: .75rem 0;
    flex: 1;
}

.sidebar-menu a {
    display: block;
    padding: .6rem 1.25rem;
    color: #94a3b8;
    font-size: .875rem;
    transition: all .15s;
    border-radius: 0;
}

.sidebar-menu a:hover,
.sidebar-menu li.active a {
    color: #fff;
    background: rgba(255,255,255,.08);
    text-decoration: none;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
}

.user-mini-name  { font-weight: 600; font-size: .8rem; color: #e2e8f0; }
.user-mini-email { font-size: .72rem; color: #64748b; }

.btn-logout {
    display: block;
    text-align: center;
    font-size: .8rem;
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 6px;
    padding: .35rem .75rem;
    transition: all .15s;
}

.btn-logout:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    text-decoration: none;
}

/* Panel main */
.panel-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem;
    max-width: calc(100vw - var(--sidebar-w));
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
}

.panel-header p {
    color: var(--text-muted);
    margin-top: .25rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: .875rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.section-subtitle {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 1rem 0 .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Stats grid ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon { font-size: 1.75rem; }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-top: .1rem; }

.stat-blue   { border-left: 3px solid var(--brand); }
.stat-green  { border-left: 3px solid var(--success); }
.stat-amber  { border-left: 3px solid var(--warning); }
.stat-red    { border-left: 3px solid var(--danger); }

/* ── Formularios ────────────────────────────────────────────── */
.auth-form, form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select, textarea {
    width: 100%;
    padding: .625rem .875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-actions {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding-top: .5rem;
}

/* ── Botones ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .5rem 1rem;
    border-radius: 7px;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.btn-primary:hover { background: var(--brand-dark); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover { background: var(--bg); }

.btn-sm { padding: .3rem .75rem; font-size: .8rem; }

.btn-full { width: 100%; justify-content: center; padding: .75rem; }

.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Alertas ────────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2em .55em;
    border-radius: 5px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ── Tabla de datos ─────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.data-table th {
    padding: .625rem .75rem;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: .75rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .table-actions { display: flex; gap: .4rem; }

/* ── Progress bars ──────────────────────────────────────────── */
.progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
    margin: .4rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 999px;
    transition: width .6s ease;
}

.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger); }

.resource-item { margin-bottom: 1.25rem; }
.resource-label {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .25rem;
}

.resource-pct { font-weight: 700; color: var(--text); }
.resource-detail { font-size: .72rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Resources grids ────────────────────────────────────────── */
.resources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.resources-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.resource-list {
    list-style: none;
    font-size: .85rem;
}

.resource-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}

.resource-list li:last-child { border-bottom: none; }
.resource-list .more-link { justify-content: center; }

/* ── Misc ───────────────────────────────────────────────────── */
.muted       { color: var(--text-muted); }
.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; font-style: italic; }

.quick-access-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.quick-actions {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-tables-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.search-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-direction: row;
    align-items: center;
}

.search-bar input { flex: 1; }

/* Paquetes grid en registro */
.paquetes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
}

.paquete-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: all .15s;
    display: block;
    text-align: center;
}

.paquete-card input { display: none; }
.paquete-card:hover, .paquete-card.selected {
    border-color: var(--brand);
    background: var(--brand-light);
}

.paquete-nombre { font-weight: 700; margin-bottom: .25rem; }
.paquete-precio { color: var(--brand); font-weight: 700; font-size: 1rem; margin-bottom: .5rem; }
.paquete-features { list-style: none; text-align: left; font-size: .78rem; color: var(--text-muted); }
.paquete-features li::before { content: '✓ '; color: var(--success); font-weight: 700; }

/* Responsive básico */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .panel-main { margin-left: 0; padding: 1rem; }
    .stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .resources-grid { grid-template-columns: 1fr; }
}
