/**
 * Archivo: assets/css/panel.css
 * Módulo: Panel base
 * Proyecto: GestorTech / ClínicaSonrisas
 * Versión: 8.2 Limpieza y estructura completa
 *
 * Descripción:
 * Estilos generales del panel.
 */

/*
 * panel.css
 * ---------
 * Diseño común de GestorTech.
 * Mantiene el estilo de la demo inicial: menú lateral azul,
 * tarjetas blancas, acciones rápidas y vista previa.
 */

:root{
    --blue:#0757d8;
    --blue2:#1688ea;
    --dark:#071847;
    --muted:#667085;
    --line:#e5ebf5;
    --bg:#f3f6fb;
    --green:#129447;
    --purple:#6f3cc3;
    --orange:#f59e0b;
    --cyan:#0ea5e9;
    --teal:#14b8a6;
}

*{box-sizing:border-box}

body{
    margin:0;
    background:var(--bg);
    color:var(--dark);
    font-family:Arial, Helvetica, sans-serif;
}

.sidebar{
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    width:280px;
    background:linear-gradient(180deg,#013b91,#06265f);
    color:#fff;
    padding:22px 18px;
    overflow:auto;
}

.side-brand{
    display:flex;
    gap:14px;
    align-items:center;
    margin-bottom:28px;
}

.logo{
    width:50px;
    height:50px;
    background:#fff;
    color:var(--blue);
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:25px;
}

.side-brand b{font-size:25px}
.side-brand span{color:#58c7ff}
.side-brand small{display:block;font-size:14px;margin-top:4px}

.sidebar nav a{
    display:block;
    padding:14px 16px;
    border-radius:10px;
    margin-bottom:7px;
    font-size:17px;
    color:#fff;
    text-decoration:none;
    opacity:.95;
}

.sidebar nav a.active,
.sidebar nav a:hover{
    background:#0968e8;
}

.user{
    margin-top:25px;
    padding:18px;
    border:1px solid rgba(255,255,255,.2);
    border-radius:12px;
}

.main{
    margin-left:280px;
    min-height:100vh;
}

.header{
    height:78px;
    background:#fff;
    border-bottom:1px solid var(--line);
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 42px;
}

.top-brand{
    font-size:29px;
    font-weight:800;
}

.top-brand span:first-child{
    background:var(--blue);
    color:#fff;
    border-radius:50%;
    padding:7px;
    margin-right:12px;
}

.top-brand span:last-child{color:var(--blue2)}

.status b{color:#169a4b}

.page-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:34px 42px 18px;
}

.page-title h1{
    margin:0 0 8px;
    font-size:36px;
}

.page-title p{
    margin:0;
    color:var(--muted);
    font-size:18px;
}

/* Días de colores */
.days-row{
    display:grid;
    grid-template-columns:repeat(6, 1fr);
    gap:10px;
    padding:0 42px 20px;
}

.day-pill{
    border:0;
    border-radius:12px;
    padding:15px;
    color:#fff;
    font-size:18px;
    font-weight:800;
    cursor:pointer;
}

.day-1{background:#0757d8}
.day-2{background:#0ea5e9}
.day-3{background:#14b8a6}
.day-4{background:#22c55e}
.day-5{background:#f59e0b}
.day-6{background:#a855f7}

/* Tarjetas de contadores */
.stats-row{
    display:flex;
    gap:18px;
    padding:0 42px 22px;
    flex-wrap:wrap;
}

.stat-card{
    background:#fff;
    border:1px solid var(--line);
    border-radius:14px;
    min-width:145px;
    height:92px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:12px;
    box-shadow:0 8px 20px rgba(15,23,42,.06);
}

.stat-card .icon{
    width:38px;
    height:38px;
    border-radius:12px;
    background:#eff6ff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
}

.stat-card b{
    display:block;
    font-size:30px;
}

.stat-card small{
    color:var(--muted);
}

.content-grid{
    display:grid;
    grid-template-columns:1fr 365px;
    gap:28px;
    padding:0 42px 42px;
}

.card,
.table-card,
.quick-card,
.preview-card{
    background:#fff;
    border:1px solid var(--line);
    border-radius:16px;
    box-shadow:0 8px 20px rgba(15,23,42,.06);
}

.table-card{overflow:hidden}

.form-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:12px;
    padding:18px;
    border-bottom:1px solid var(--line);
}

input, select{
    height:44px;
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:0 12px;
    font-size:15px;
    background:#fff;
}

.btn{
    border:1px solid #bcd2fb;
    background:#fff;
    color:var(--blue);
    padding:10px 14px;
    border-radius:8px;
    cursor:pointer;
    font-weight:800;
    text-decoration:none;
    display:inline-block;
}

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

.btn.danger{
    color:#b91c1c;
    border-color:#fecaca;
}

.btn.play{
    background:#0b63ce;
    color:#fff;
    border-color:#0b63ce;
}

.table-toolbar{
    display:flex;
    gap:12px;
    align-items:center;
    justify-content:space-between;
    padding:18px;
    border-bottom:1px solid var(--line);
    flex-wrap:wrap;
}

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

th, td{
    padding:16px;
    border-bottom:1px solid var(--line);
    text-align:left;
    vertical-align:middle;
}

th{
    text-transform:uppercase;
    font-size:13px;
    color:#344054;
    letter-spacing:.5px;
}

.turno-box{
    width:68px;
    height:64px;
    background:#eff6ff;
    border-radius:10px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    color:var(--blue);
    font-weight:800;
    font-size:28px;
}

.turno-box small{
    font-size:12px;
    color:#344054;
    font-weight:500;
}

.person-icon{
    width:42px;
    height:42px;
    border-radius:50%;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    margin-right:10px;
    background:#e8f1ff;
    font-size:21px;
}

.doctor-avatar{
    width:42px;
    height:42px;
    border-radius:50%;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    margin-right:10px;
    background:#e8f1ff;
    font-size:21px;
}

.estado{
    display:inline-block;
    padding:8px 13px;
    border-radius:999px;
    font-weight:800;
    font-size:13px;
}

.estado.pendiente{background:#eef2f7;color:#475467}
.estado.presente{background:#dcfce7;color:#166534}
.estado.proximo{background:#ede9fe;color:#5b21b6}
.estado.atendido{background:#e0f2fe;color:#075985}

.pagination{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:15px 18px;
}

/* Panel lateral: acciones rápidas y vista previa */
.side-panel{
    display:flex;
    flex-direction:column;
    gap:22px;
}

.quick-card,
.preview-card{
    padding:22px;
}

.quick-card h3,
.preview-card h3{
    margin:0 0 15px;
}

.quick-card button{
    display:block;
    width:100%;
    border:0;
    border-radius:10px;
    padding:18px;
    margin:12px 0;
    color:#fff;
    font-size:17px;
    font-weight:800;
    text-align:left;
    cursor:pointer;
}

.green{background:var(--green)}
.blue{background:var(--blue)}
.purple{background:var(--purple)}

.mini-preview{
    background:#061a44;
    color:#fff;
    border-radius:12px;
    padding:18px;
    text-align:center;
}

.mini-preview b{
    display:block;
    font-size:58px;
    color:#ffd333;
}

.mini-preview span{
    display:block;
    font-size:24px;
    margin:8px 0;
}

.mini-preview strong{
    display:block;
    font-size:20px;
}

.mini-preview em{
    display:block;
    background:#ffd333;
    color:#061a44;
    border-radius:8px;
    margin-top:15px;
    padding:9px;
    font-style:normal;
    font-weight:800;
}

.preview-list{
    font-size:12px;
    margin-top:12px;
}

.preview-list div{
    display:grid;
    grid-template-columns:1fr .8fr .8fr;
    gap:6px;
    padding:5px 0;
    border-bottom:1px solid rgba(255,255,255,.15);
}

.module-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:20px;
    padding:0 42px 42px;
}

.module-card{
    background:#fff;
    border:1px solid var(--line);
    border-radius:16px;
    padding:26px;
    box-shadow:0 8px 20px rgba(15,23,42,.06);
    text-decoration:none;
    color:var(--dark);
}

.module-card .icon{
    font-size:34px;
    margin-bottom:14px;
}

.module-card b{
    font-size:22px;
}

.module-card p{
    color:var(--muted);
    line-height:1.45;
}

.fuentes-grid{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:16px;
    padding:18px;
}

.fuente{
    border:1px solid var(--line);
    border-radius:14px;
    padding:18px;
    text-align:center;
    min-height:142px;
    background:#fff;
}

.fuente .icon{
    font-size:34px;
    margin-bottom:10px;
}

.fuente b{
    display:block;
    font-size:18px;
    margin-bottom:8px;
}

.fuente span{
    display:inline-block;
    border-radius:999px;
    padding:5px 10px;
    background:#dcfce7;
    color:#166534;
    font-size:12px;
}

.tabs{
    display:flex;
    gap:12px;
    padding:0 42px 18px;
}

.tab-btn{
    border:1px solid var(--line);
    background:#fff;
    border-radius:12px;
    padding:12px 18px;
    cursor:pointer;
    font-weight:800;
}

.tab-btn.active{
    background:var(--blue);
    color:#fff;
}

.hidden{
    display:none !important;
}

@media(max-width:1200px){
    .sidebar{position:static;width:auto}
    .main{margin-left:0}
    .content-grid{grid-template-columns:1fr}
    .module-grid,.fuentes-grid{grid-template-columns:repeat(2,1fr)}
    .form-grid{grid-template-columns:1fr 1fr}
}


/* Mejoras V6 - módulo Contenido */
.fuente p{
    margin:10px 0 0;
}
input[type="color"]{
    padding:4px;
    cursor:pointer;
}


/* V7 - módulo contenido refinado */
.content-full{
    display:grid;
    grid-template-columns:1fr 365px;
    gap:28px;
    padding:0 42px 42px;
}
.content-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:22px;
    border-bottom:1px solid var(--line);
}
.content-header h2{margin:0 0 6px}
.content-header p{margin:0;color:var(--muted)}
.content-grid-cards{
    grid-template-columns:repeat(4,1fr);
}
.fuente-card{
    min-height:190px;
    position:relative;
}
.channel-icon{
    width:54px;
    height:54px;
    margin:0 auto 10px;
    border-radius:15px;
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:900;
    font-size:25px;
}
.badges{
    display:flex;
    gap:5px;
    justify-content:center;
    flex-wrap:wrap;
    margin-top:8px;
}
.active-badge,.ok-badge,.warn-badge,.url-badge,.no-url-badge{
    display:inline-block;
    border-radius:999px;
    padding:5px 9px;
    font-size:11px;
    font-weight:800;
}
.active-badge{background:#dbeafe;color:#0757d8}
.ok-badge{background:#dcfce7;color:#166534}
.warn-badge{background:#fef3c7;color:#92400e}
.url-badge{background:#e0f2fe;color:#075985}
.no-url-badge{background:#f1f5f9;color:#475569}
.card-actions{
    margin-top:14px;
    display:flex;
    gap:6px;
    justify-content:center;
    flex-wrap:wrap;
}
.drawer-overlay{
    position:fixed;
    inset:0;
    background:rgba(15,23,42,.38);
    opacity:0;
    pointer-events:none;
    transition:.2s;
    z-index:50;
}
.drawer-overlay.open{
    opacity:1;
    pointer-events:auto;
}
.content-drawer{
    position:fixed;
    top:0;
    right:-440px;
    width:420px;
    height:100vh;
    background:#fff;
    box-shadow:-18px 0 40px rgba(15,23,42,.22);
    z-index:60;
    padding:24px;
    overflow:auto;
    transition:.25s;
}
.content-drawer.open{
    right:0;
}
.drawer-head{
    display:flex;
    justify-content:space-between;
    gap:18px;
    border-bottom:1px solid var(--line);
    padding-bottom:16px;
    margin-bottom:18px;
}
.drawer-head h3{margin:0 0 5px;font-size:24px}
.drawer-head p{margin:0;color:var(--muted)}
.drawer-close{
    width:38px;
    height:38px;
    border:0;
    background:#eff6ff;
    border-radius:10px;
    cursor:pointer;
    font-size:25px;
    color:#0757d8;
}
.content-drawer label{
    display:block;
    margin:14px 0 6px;
    font-weight:800;
}
.content-drawer input,
.content-drawer select,
.content-drawer textarea{
    width:100%;
}
.content-drawer textarea{
    min-height:90px;
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:12px;
    font-family:Arial,Helvetica,sans-serif;
}
.drawer-actions{
    display:flex;
    gap:10px;
    margin-top:20px;
}
@media(max-width:1200px){
    .content-full{grid-template-columns:1fr}
    .content-grid-cards{grid-template-columns:repeat(2,1fr)}
}


/* V7 - ajustes rápidos en tabla de citas */
td .btn{
    margin-bottom:6px;
}
td:nth-child(6){
    min-width:300px;
}
td:nth-child(3){
    min-width:160px;
}
td:nth-child(2){
    min-width:220px;
}


/* Limpieza V1 - Citas */
.days-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 0 42px 20px;
}

.day-pill {
    border: 0;
    border-radius: 12px;
    padding: 13px 10px;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

.day-pill small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    opacity: .95;
}

.day-pill.selected {
    outline: 3px solid rgba(7,87,216,.25);
    transform: translateY(-1px);
}

.citas-table td {
    vertical-align: middle;
}

.patient-cell,
.doctor-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-cell small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.actions-cell {
    width: 70px;
    text-align: right;
    position: relative;
}

.row-menu-wrap {
    position: relative;
    display: inline-block;
}

.dots-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 23px;
    line-height: 1;
}

.row-menu {
    position: absolute;
    right: 0;
    top: 42px;
    width: 190px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
    z-index: 20;
    display: none;
    overflow: hidden;
}

.row-menu.open {
    display: block;
}

.row-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 700;
    color: var(--dark);
}

.row-menu button:hover {
    background: #eff6ff;
}

.row-menu button.danger {
    color: #b91c1c;
}

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

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    width: min(780px, 96vw);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 25px 70px rgba(15,23,42,.25);
    overflow: hidden;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

.modal-head h3 {
    margin: 0 0 6px;
    font-size: 26px;
}

.modal-head p {
    margin: 0;
    color: var(--muted);
}

.modal-close {
    width: 42px;
    height: 42px;
    border: 0;
    background: #eff6ff;
    color: var(--blue);
    border-radius: 12px;
    font-size: 28px;
    cursor: pointer;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 24px;
}

.modal-grid label {
    display: block;
    font-weight: 800;
    color: var(--dark);
}

.modal-grid input,
.modal-grid select {
    width: 100%;
    margin-top: 7px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 24px 24px;
}

.preview-card p {
    color: var(--muted);
    line-height: 1.45;
    margin: 8px 0;
}

@media(max-width:1200px){
    .days-row { grid-template-columns: repeat(2, 1fr); }
    .modal-grid { grid-template-columns: 1fr; }
}


/* ==========================================================
   BLOQUE V2 - Citas y pacientes
   ========================================================== */

.days-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 0 42px 20px;
}

.day-pill {
    border: 0;
    border-radius: 12px;
    padding: 13px 10px;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 18px rgba(15,23,42,.08);
}

.day-pill small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    opacity: .95;
}

.day-pill.selected {
    outline: 4px solid rgba(7,87,216,.22);
    transform: translateY(-1px);
}

.citas-table td {
    vertical-align: middle;
}

.date-cell {
    min-width: 82px;
}

.date-cell b {
    display: block;
    font-size: 18px;
}

.date-cell small,
.line-muted {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.patient-cell,
.doctor-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-cell small,
.doctor-cell small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.urgencia-badge {
    display: inline-block;
    margin-top: 6px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
}

.urgencia-badge.normal {
    background: #f1f5f9;
    color: #475569;
}

.urgencia-badge.preferente {
    background: #fef3c7;
    color: #92400e;
}

.urgencia-badge.urgente {
    background: #fee2e2;
    color: #b91c1c;
}

.actions-cell {
    min-width: 285px;
    position: relative;
}

.btn.small {
    padding: 8px 10px;
    font-size: 13px;
    margin: 2px;
}

.btn.danger {
    color: #b91c1c;
    border-color: #fecaca;
}

.row-menu-wrap {
    position: relative;
    display: inline-block;
}

.dots-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 23px;
    line-height: 1;
}

.row-menu {
    position: absolute;
    right: 0;
    top: 42px;
    width: 195px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
    z-index: 20;
    display: none;
    overflow: hidden;
}

.row-menu.open {
    display: block;
}

.row-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 700;
    color: var(--dark);
}

.row-menu button:hover {
    background: #eff6ff;
}

.row-menu button.danger {
    color: #b91c1c;
}

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

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    width: min(880px, 96vw);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 25px 70px rgba(15,23,42,.25);
    overflow: hidden;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

.modal-head h3 {
    margin: 0 0 6px;
    font-size: 26px;
}

.modal-head p {
    margin: 0;
    color: var(--muted);
}

.modal-close {
    width: 42px;
    height: 42px;
    border: 0;
    background: #eff6ff;
    color: var(--blue);
    border-radius: 12px;
    font-size: 28px;
    cursor: pointer;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 24px;
}

.modal-grid label {
    display: block;
    font-weight: 800;
    color: var(--dark);
}

.modal-grid input,
.modal-grid select {
    width: 100%;
    margin-top: 7px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 24px 24px;
}

.preview-card p {
    color: var(--muted);
    line-height: 1.45;
    margin: 8px 0;
}

@media(max-width:1200px){
    .days-row { grid-template-columns: repeat(2, 1fr); }
    .modal-grid { grid-template-columns: 1fr; }
    .actions-cell { min-width: 220px; }
}
