/**
 * Archivo: assets/css/patch_v3.css
 * Módulo: Patch V3
 * Proyecto: GestorTech / ClínicaSonrisas
 * Versión: 8.2 Limpieza y estructura completa
 *
 * Descripción:
 * Ajustes visuales heredados.
 */

/*
 * patch_v3.css
 * ------------
 * Ajustes seguros:
 * - menú superior,
 * - más espacio de trabajo,
 * - tablas de citas/pacientes,
 * - modales,
 * - contenido con preview.
 */

body.top-layout {
    background: #f3f6fb;
}

body.top-layout .sidebar {
    display: none !important;
}

body.top-layout .main,
body.top-layout .top-main {
    margin-left: 0 !important;
    min-height: calc(100vh - 104px);
}

.top-shell {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #fff;
    border-bottom: 1px solid #e5ebf5;
    box-shadow: 0 8px 24px rgba(15,23,42,.06);
}

.top-shell-main {
    height: 68px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 28px;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid #dbe7fb;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-size: 23px;
    color: #0757d8;
}

.top-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #071847;
    min-width: 260px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg,#0757d8,#0aa6d8);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.top-brand-link b {
    font-size: 24px;
    line-height: 1;
}

.top-brand-link b span {
    color: #1688ea;
}

.top-brand-link small {
    display: block;
    font-size: 13px;
    color: #667085;
    margin-top: 3px;
}

.top-status {
    margin-left: auto;
    color: #071847;
}

.top-status b {
    color: #128a42;
}

.top-menu {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 28px 12px;
    overflow: visible;
}

.top-menu a,
.top-menu-item > button {
    border: 0;
    background: transparent;
    color: #071847;
    text-decoration: none;
    padding: 11px 13px;
    border-radius: 11px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.top-menu a:hover,
.top-menu a.active,
.top-menu-item.active > button,
.top-menu-item > button:hover {
    background: #0757d8;
    color: #fff;
}

.top-menu a.disabled {
    opacity: .42;
    cursor: not-allowed;
}

.top-menu-item {
    position: relative;
}

.top-submenu {
    display: none;
    position: absolute;
    top: 44px;
    left: 0;
    width: 230px;
    background: #fff;
    border: 1px solid #e5ebf5;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
}

.top-menu-item:hover > .top-submenu {
    display: block;
}

.top-submenu a,
.top-submenu .top-menu-item > button {
    display: flex;
    width: 100%;
    justify-content: flex-start;
}

.page-title {
    padding: 28px 34px 18px !important;
}

.content-grid {
    padding-left: 34px !important;
    padding-right: 34px !important;
}

/* Días y contadores */
.days-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 0 34px 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);
}

/* Tablas */
.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: #667085;
    font-size: 13px;
}

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

.patient-cell small,
.doctor-cell small {
    display: block;
    color: #667085;
    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: 300px;
    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 #e5ebf5;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 23px;
    line-height: 1;
}

.row-menu {
    position: absolute;
    right: 0;
    top: 42px;
    width: 205px;
    background: #fff;
    border: 1px solid #e5ebf5;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(15,23,42,.16);
    z-index: 50;
    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: #071847;
}

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

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

.empty-table {
    text-align: center;
    padding: 35px;
    color: #667085;
}

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

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

.modal-card {
    width: min(900px, 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 #e5ebf5;
}

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

.modal-head p {
    margin: 0;
    color: #667085;
}

.modal-close {
    width: 42px;
    height: 42px;
    border: 0;
    background: #eff6ff;
    color: #0757d8;
    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: #071847;
}

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

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

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

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px;
    border-bottom: 1px solid #e5ebf5;
}

.content-header h2 {
    margin: 0 0 6px;
}

.content-header p {
    margin: 0;
    color: #667085;
}

.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:250;
}

.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:260;
    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 #e5ebf5;
    padding-bottom:16px;
    margin-bottom:18px;
}

.drawer-head h3 {
    margin:0 0 5px;
    font-size:24px;
}

.drawer-head p {
    margin:0;
    color:#667085;
}

.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;
}

.preview-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    background: #071847;
}

@media(max-width:1200px) {
    .top-shell-main {
        padding: 0 16px;
    }

    .top-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 8px 16px 16px;
    }

    .top-menu.open {
        display: flex;
    }

    .top-menu-item:hover > .top-submenu {
        display: none;
    }

    .top-menu-item .top-submenu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 10px;
        margin-top: 6px;
    }

    .top-menu-item.active > .top-submenu,
    .top-menu-item:focus-within > .top-submenu {
        display: block;
    }

    .top-status {
        display: none;
    }

    .days-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-grid,
    .content-full {
        grid-template-columns: 1fr !important;
    }

    .content-grid-cards {
        grid-template-columns: repeat(2,1fr);
    }

    .modal-grid {
        grid-template-columns: 1fr;
    }

    .actions-cell {
        min-width: 220px;
    }
}
