/* ============================================================
   wwwroot/css/admin.css  —  DentiControl.Admin
   Estilos completos del panel de administración
   ============================================================ */

/* ── Reset y base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --azul:      #1B4EA8;
    --azul-dark: #163d85;
    --azul-light:#e0e7ff;
    --naranja:   #E8431A;
    --gris:      #f3f4f6;
    --borde:     #e5e7eb;
    --texto:     #111827;
    --muted:     #6b7280;
    --sombra:    0 2px 8px rgba(0,0,0,.08);
    --radius:    12px;
    --sidebar-w: 230px;
}

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

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

/* ── Layout con sidebar ───────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--azul);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
}

.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 2rem;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Layout sin sidebar (Login) */
.main-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B4EA8 0%, #163d85 50%, #E8431A 100%);
}

/* ── Sidebar: Logo ────────────────────────────────────────── */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.logo-icon  { font-size: 1.75rem; }
.logo-title { display: block; color: #fff; font-weight: 700; font-size: 1rem; }
.logo-sub   { display: block; color: rgba(255,255,255,.6); font-size: .72rem; letter-spacing: .5px; }

/* ── Sidebar: Navegación ──────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.25rem;
    color: rgba(255,255,255,.75);
    font-size: .93rem;
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
}
.nav-item:hover  { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; border-left: 3px solid #fff; }
.nav-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }

/* ── Sidebar: Footer ──────────────────────────────────────── */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.15);
}
.admin-info    { margin-bottom: .6rem; }
.admin-name    { display: block; color: #fff; font-weight: 600; font-size: .9rem; }
.admin-role    { display: block; color: rgba(255,255,255,.55); font-size: .72rem; letter-spacing: 1px; }
.btn-logout {
    width: 100%;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
    border: none;
    padding: .5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
    transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.22); color: #fff; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1  { font-size: 1.5rem; color: var(--azul); }
.page-date       { color: var(--muted); font-size: .9rem; margin-left: auto; }
.resultado-count { color: var(--muted); font-size: .88rem; }

/* ── Cards / sections ────────────────────────────────────── */
.section-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--sombra);
}
.section-card h2, .section-card h3 {
    color: var(--azul);
    margin-bottom: 1rem;
    font-size: 1rem;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.link-ver-todo { color: var(--azul); font-size: .88rem; }
.link-ver-todo:hover { text-decoration: underline; }
.mt-1 { margin-top: 1rem; }

/* ── KPI Stats grid ──────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.2rem 1rem;
    text-align: center;
    box-shadow: var(--sombra);
    border-top: 4px solid #ccc;
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-total      { border-color: var(--azul); }
.stat-activa     { border-color: #22c55e; }
.stat-trial      { border-color: #f59e0b; }
.stat-suspendida { border-color: #ef4444; }
.stat-mes        { border-color: #8b5cf6; }
.stat-pacientes  { border-color: var(--naranja); }
.stat-citas      { border-color: #06b6d4; }
.stat-icon  { font-size: 1.8rem; margin-bottom: .3rem; }
.stat-num   { font-size: 2rem; font-weight: 700; color: var(--azul); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--muted); margin-top: .35rem; }

/* ── Toolbar de búsqueda ──────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-form { display: flex; gap: .5rem; flex: 1; flex-wrap: wrap; }
.search-input, .filter-select {
    padding: .5rem .85rem;
    border: 1px solid var(--borde);
    border-radius: 8px;
    font-size: .93rem;
    outline: none;
    transition: border-color .2s;
}
.search-input  { flex: 1; min-width: 180px; }
.filter-select { min-width: 160px; }
.search-input:focus, .filter-select:focus { border-color: var(--azul); }

/* ── Botones globales ────────────────────────────────────── */
.btn-primary {
    background: var(--azul); color: #fff;
    border: none; padding: .5rem 1.1rem;
    border-radius: 8px; cursor: pointer; font-size: .9rem;
    white-space: nowrap; transition: background .15s;
}
.btn-primary:hover { background: var(--azul-dark); }

.btn-secondary {
    background: var(--gris); color: #374151;
    border: none; padding: .5rem .85rem;
    border-radius: 8px; cursor: pointer; font-size: .9rem;
    white-space: nowrap; text-decoration: none;
    display: inline-block; transition: background .15s;
}
.btn-secondary:hover { background: var(--borde); }

.btn-back {
    background: var(--azul-light); color: var(--azul);
    padding: .4rem .9rem; border-radius: 8px;
    font-size: .9rem; font-weight: 600; white-space: nowrap;
    transition: background .15s;
}
.btn-back:hover { background: #c7d2fe; }

/* ── Tabla ───────────────────────────────────────────────── */
.table-container { overflow-x: auto; border-radius: var(--radius); }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: .87rem;
}
.admin-table thead th {
    background: var(--azul); color: #fff;
    padding: .75rem 1rem;
    text-align: left; font-weight: 600; white-space: nowrap;
}
.admin-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td     { background: #f8faff; }
.text-center { text-align: center !important; }
.text-muted  { color: var(--muted); }
.link-text   { color: var(--azul); }
.link-text:hover { text-decoration: underline; }

/* ── Badges de estado ─────────────────────────────────────── */
.badge-estado {
    display: inline-block; padding: .22rem .65rem;
    border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-activa       { background: #dcfce7; color: #166534; }
.badge-trial        { background: #fef3c7; color: #92400e; }
.badge-trialvencido { background: #fee2e2; color: #991b1b; }
.badge-suspendida   { background: #f1f5f9; color: #475569; }
.badge-vencida      { background: #fee2e2; color: #991b1b; }

/* Badges de acción en log */
.badge-accion {
    display: inline-block; padding: .2rem .6rem;
    border-radius: 6px; font-size: .73rem; font-weight: 700; letter-spacing: .5px;
}
.badge-activar   { background: #dcfce7; color: #166534; }
.badge-suspender { background: #fee2e2; color: #991b1b; }

/* ── Botones en tabla ─────────────────────────────────────── */
.acciones { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.btn-ver {
    background: var(--azul-light); color: var(--azul);
    border: none; padding: .28rem .65rem; border-radius: 6px;
    cursor: pointer; font-size: .8rem; text-decoration: none; white-space: nowrap;
}
.btn-ver:hover { background: #c7d2fe; }
.btn-activar {
    background: #dcfce7; color: #166534;
    border: none; padding: .28rem .65rem; border-radius: 6px;
    cursor: pointer; font-size: .8rem; white-space: nowrap;
}
.btn-activar:hover { background: #bbf7d0; }
.btn-suspender {
    background: #fee2e2; color: #991b1b;
    border: none; padding: .28rem .65rem; border-radius: 6px;
    cursor: pointer; font-size: .8rem; white-space: nowrap;
}
.btn-suspender:hover { background: #fecaca; }
.btn-full { width: 100%; padding: .65rem 1rem; font-size: .93rem; margin-top: .5rem; border-radius: 8px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.modal-box {
    background: #fff; border-radius: 16px; padding: 2rem;
    width: 360px; max-width: 90vw;
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-box h3  { margin: 0 0 1rem; color: var(--azul); font-size: 1.1rem; }
.modal-box p   { margin: 0 0 .75rem; font-size: .95rem; }
.form-select {
    width: 100%; padding: .5rem .75rem;
    border: 1px solid var(--borde); border-radius: 8px; font-size: .95rem;
    margin: .4rem 0 1.25rem; outline: none;
}
.modal-btns { display: flex; gap: .75rem; justify-content: flex-end; }

/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(255,255,255,.75);
    display: flex; align-items: center; justify-content: center; z-index: 9998;
}
.loading-spinner {
    background: var(--azul); color: #fff;
    padding: 1rem 2rem; border-radius: 12px; font-size: 1rem; font-weight: 600;
}

/* ── Login ───────────────────────────────────────────────── */
.login-wrapper {
    width: 100%; display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 1rem;
}
.login-card {
    background: #fff; border-radius: 20px; padding: 2.5rem 2rem;
    width: 100%; max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,.2);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo-icon { font-size: 3rem; }
.login-title { font-size: 1.5rem; color: var(--azul); margin: .5rem 0 .2rem; }
.login-subtitle { color: var(--muted); font-size: .9rem; }
.login-form { display: flex; flex-direction: column; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: #374151; }
.form-input {
    padding: .65rem .85rem; border: 1px solid var(--borde);
    border-radius: 10px; font-size: .95rem; outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: var(--azul); }
.btn-login {
    background: var(--azul); color: #fff; border: none;
    padding: .8rem; border-radius: 10px; font-size: 1rem;
    font-weight: 600; cursor: pointer; margin-top: .5rem;
    transition: background .15s;
}
.btn-login:hover { background: var(--azul-dark); }
.login-footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 1.5rem; }
.alert-error {
    background: #fee2e2; color: #991b1b;
    padding: .75rem 1rem; border-radius: 8px;
    font-size: .9rem; margin-bottom: 1rem;
}

/* ── Detalle de clínica ───────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem; margin-bottom: 1rem;
}
.detail-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.detail-table th {
    width: 40%; text-align: left; padding: .45rem .5rem;
    color: var(--muted); font-weight: 600; border-bottom: 1px solid #f3f4f6;
}
.detail-table td { padding: .45rem .5rem; border-bottom: 1px solid #f3f4f6; }
.uso-stats { display: flex; gap: 2rem; margin-bottom: 1rem; }
.uso-item  { text-align: center; }
.uso-num   { display: block; font-size: 2rem; font-weight: 700; color: var(--azul); }
.uso-label { display: block; font-size: .8rem; color: var(--muted); }
.acciones-col { display: flex; flex-direction: column; gap: .5rem; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    background: #fff; border-radius: var(--radius);
    padding: 2.5rem; text-align: center; color: var(--muted);
    box-shadow: var(--sombra);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .logo-text, .nav-item span:not(.nav-icon), .admin-info, .btn-logout { display: none; }
    .sidebar-logo { justify-content: center; padding: 1rem; }
    .nav-item { justify-content: center; padding: .75rem; }
    .main-content { margin-left: 60px; padding: 1rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid  { grid-template-columns: repeat(2, 1fr); }
}
