/* Dentique Dental Group - Paleta clínica y salud (fuente Inter en base.html) */

:root {
    /* Paleta salud/clínica: azul médico + tonos limpios */
    --health-primary: #0284c7;
    --health-primary-dark: #0369a1;
    --health-primary-light: rgba(2, 132, 199, 0.12);
    --health-sidebar: #0c4a6e;
    --health-sidebar-hover: #075985;
    --health-sidebar-border: rgba(255,255,255,0.08);
    --health-bg: #f0f9ff;
    --health-bg-alt: #e0f2fe;
    --health-card: #ffffff;
    --health-card-border: #bae6fd;
    --health-text: #0c4a6e;
    --health-text-muted: #0369a1;
    --health-border: #bae6fd;
    --health-success: #059669;
    /* Variables globales (tech = alias para no romper clases) */
    --tech-sidebar: var(--health-sidebar);
    --tech-sidebar-hover: var(--health-sidebar-hover);
    --tech-sidebar-border: var(--health-sidebar-border);
    --tech-accent: var(--health-primary);
    --tech-accent-hover: var(--health-primary-dark);
    --tech-accent-light: var(--health-primary-light);
    --tech-bg: var(--health-bg);
    --tech-card: var(--health-card);
    --tech-card-border: var(--health-card-border);
    --tech-text: var(--health-text);
    --tech-text-muted: var(--health-text-muted);
    --tech-border: var(--health-border);
    --dentique-primary: var(--health-primary);
    --dentique-primary-dark: var(--health-primary-dark);
    --dentique-primary-light: var(--health-primary-light);
    --dentique-sidebar-bg: var(--health-sidebar);
    --dentique-sidebar-hover: var(--health-sidebar-hover);
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }

body { background: var(--health-bg); color: var(--health-text); }

/* ----- Sidebar ----- */
.sidebar.dentique-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--health-sidebar);
    color: #e0f2fe;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    box-shadow: 4px 0 24px rgba(12, 74, 110, 0.2);
}
.sidebar-header {
    padding: 1.35rem 1.25rem;
    border-bottom: 1px solid var(--health-sidebar-border);
}
.logo-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}
.sidebar-header small { color: #7dd3fc; font-size: 0.75rem; }
.sidebar-nav { padding: 0.75rem 0; flex: 1; }
.sidebar-nav .nav-link {
    color: #7dd3fc;
    padding: 0.6rem 1.25rem;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.sidebar-nav .nav-link:hover {
    background: var(--health-sidebar-hover);
    color: #f0f9ff;
    border-left-color: #38bdf8;
}
.sidebar-nav .nav-link i {
    width: 1.25rem;
    text-align: center;
    opacity: 0.95;
}
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--health-sidebar-border);
}

/* ----- Main content ----- */
.main-content {
    background: var(--health-bg);
    min-height: 100vh;
    padding: 1.5rem !important;
}

/* ----- Cards ----- */
.card-dentique {
    background: var(--health-card);
    border: 1px solid var(--health-card-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08);
    overflow: hidden;
}
.card-dentique .card-header {
    background: linear-gradient(135deg, var(--health-primary) 0%, var(--health-primary-dark) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.9rem 1.25rem;
    border: none;
}
.card-dentique .card-body { padding: 1.25rem; }
.card-dentique .card-footer {
    background: var(--health-bg-alt);
    border-top: 1px solid var(--health-border);
    padding: 0.75rem 1.25rem;
}

/* ----- Botones ----- */
.btn-dentique, .btn-primary {
    background: linear-gradient(135deg, var(--health-primary) 0%, var(--health-primary-dark) 100%);
    border: none;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.3);
}
.btn-dentique:hover, .btn-primary:hover {
    background: var(--health-primary-dark);
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
    transform: translateY(-1px);
}
.bg-dentique { background: var(--health-primary) !important; }
.text-dentique { color: var(--health-primary) !important; }
.border-dentique { border-color: var(--health-primary) !important; }

/* ----- Tablas ----- */
.table {
    --bs-table-hover-bg: var(--tech-accent-light);
    --bs-table-hover-color: var(--tech-text);
}
.table thead th {
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    color: var(--health-text);
    border-bottom: 2px solid var(--health-border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.85rem 1rem;
}
.table td { padding: 0.85rem 1rem; vertical-align: middle; }
.table tbody tr { transition: background 0.15s ease; }
.table tbody tr:hover { background: var(--health-primary-light); }
.table-borderless thead th { border-bottom: 2px solid var(--health-border); }

/* ----- Calendario ----- */
.tech-calendar-wrap {
    background: var(--health-card);
    border-radius: 12px;
    border: 1px solid var(--health-card-border);
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08);
    overflow: hidden;
    padding: 1rem;
}
.tech-calendar-wrap .fc {
    --fc-border-color: var(--health-border);
    --fc-button-bg-color: transparent;
    --fc-button-border-color: var(--health-border);
    --fc-button-text-color: var(--health-text);
    --fc-button-hover-bg-color: var(--health-primary-light);
    --fc-button-hover-border-color: var(--health-primary);
    --fc-button-hover-text-color: var(--health-primary);
    --fc-button-active-bg-color: var(--health-primary);
    --fc-button-active-border-color: var(--health-primary);
    --fc-button-active-text-color: #fff;
    --fc-today-bg-color: var(--health-primary-light);
    --fc-page-bg-color: var(--health-card);
    --fc-neutral-bg-color: #f0f9ff;
}
.tech-calendar-wrap .fc .fc-toolbar {
    padding: 0.5rem 0 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--health-border);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tech-calendar-wrap .fc .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--health-text);
    letter-spacing: -0.02em;
}
.tech-calendar-wrap .fc .fc-button {
    padding: 0.45rem 0.85rem;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    text-transform: capitalize;
}
.tech-calendar-wrap .fc .fc-button-primary:not(:disabled):hover,
.tech-calendar-wrap .fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--health-primary) !important;
    border-color: var(--health-primary) !important;
    color: #fff !important;
}
.tech-calendar-wrap .fc .fc-col-header-cell {
    background: #f0f9ff;
    padding: 0.6rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--health-text-muted);
    border-color: var(--health-border);
}
.tech-calendar-wrap .fc .fc-daygrid-day {
    border-color: var(--health-border);
}
.tech-calendar-wrap .fc .fc-daygrid-day-number {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--health-text-muted);
    padding: 0.35rem 0.5rem;
    margin: 0.25rem;
    border-radius: 6px;
}
.tech-calendar-wrap .fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: var(--health-primary);
    color: #fff;
}
.tech-calendar-wrap .fc .fc-event {
    border: none;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(2, 132, 199, 0.15);
}
.tech-calendar-wrap .fc .fc-event:hover {
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    filter: brightness(1.05);
}
.tech-calendar-wrap .fc .fc-scrollgrid {
    border-radius: 8px;
    overflow: hidden;
}
.tech-calendar-wrap .fc .fc-daygrid-body-unbalanced .fc-daygrid-day-events {
    min-height: 2em;
}
.tech-calendar-wrap .fc-timegrid-slot {
    height: 2.5em;
}
.tech-calendar-wrap .fc-timegrid-axis {
    font-size: 0.7rem;
    color: var(--tech-text-muted);
}

/* Dashboard calendar (más compacto) */
.tech-calendar-dashboard.tech-calendar-wrap .fc .fc-toolbar-title { font-size: 1rem; }
.tech-calendar-dashboard.tech-calendar-wrap .fc .fc-button { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

/* ----- Modales ----- */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(12, 74, 110, 0.15);
}
.modal-header.bg-dentique {
    background: linear-gradient(135deg, var(--health-primary) 0%, var(--health-primary-dark) 100%) !important;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.25rem;
}
.modal-header .modal-title { font-weight: 600; }

/* ----- Formularios ----- */
.form-control, .form-select {
    border-radius: 8px;
    border-color: var(--health-border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--health-primary);
    box-shadow: 0 0 0 3px var(--health-primary-light);
}

/* ----- Alertas ----- */
.alert { border-radius: 8px; border: none; }
.alert-stock { border-left: 4px solid #dc3545; }

/* ----- Botones de acción en listas ----- */
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.table-actions .btn {
    font-size: 0.8125rem;
    padding: 0.35rem 0.65rem;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
}
.table-actions .btn i { width: 1em; margin-right: 0.25rem; opacity: 0.9; }
.table-actions .btn-outline-primary { color: var(--health-primary); border-color: var(--health-primary); }
.table-actions .btn-outline-primary:hover { background: var(--health-primary); color: #fff; }
.table-actions .btn-outline-info:hover { background: #0ea5e9; color: #fff; }
.table-actions .btn-outline-secondary:hover { background: #64748b; color: #fff; }
.table-actions .btn-outline-danger:hover { background: #dc3545; color: #fff; }
.table-actions .btn-outline-success:hover { background: var(--health-success); color: #fff; }
.table td:last-child { vertical-align: middle; }

/* ----- Dashboard stats cards ----- */
.card-dentique .rounded-circle.bg-dentique {
    background: linear-gradient(135deg, var(--health-primary) 0%, var(--health-primary-dark) 100%) !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.card-dentique .card-body h6.text-muted { color: var(--health-text-muted) !important; font-size: 0.8rem; font-weight: 500; }
.card-dentique .card-body h3 { font-weight: 700; color: var(--health-text); letter-spacing: -0.02em; }

/* ----- Pagination ----- */
.pagination .page-link {
    border-radius: 6px !important;
    margin: 0 2px;
    font-weight: 500;
}
.pagination .page-item.active .page-link {
    background: var(--health-primary);
    border-color: var(--health-primary);
}

/* ----- Badges ----- */
.badge { font-weight: 500; padding: 0.35em 0.65em; border-radius: 6px; }

.fw-600 { font-weight: 600; }

/* ----- Responsive ----- */
@media (max-width: 991.98px) {
    .sidebar.dentique-sidebar {
        position: fixed;
        left: -260px;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    .sidebar.dentique-sidebar.show { left: 0; }
    .main-content { margin-left: 0; padding: 1rem !important; }
}
.navbar-toggler-dentique {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1051;
    background: var(--health-primary);
    border: none;
    color: #fff;
    border-radius: 8px;
}

/* ----- Odontograma: dientes con estilos ----- */
.odontograma-table { max-width: 720px; }
.odontograma-table td { padding: 4px; vertical-align: middle; }
.odontograma-table .quadrant-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--health-text-muted);
    padding: 4px 0;
}

/* Contenedor de cada diente (clicable) */
.diente {
    position: relative;
    cursor: pointer;
    width: 100%;
    min-width: 44px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.diente:hover { transform: scale(1.03); }
.diente:hover .diente-crown {
    box-shadow: 0 2px 8px rgba(12, 74, 110, 0.2), inset 0 1px 0 rgba(255,255,255,0.9);
    border-color: var(--health-primary);
}

/* Corona del diente (forma dental) */
.diente-crown {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 32px;
    max-height: 36px;
    border: 1px solid #d4cfc4;
    background: linear-gradient(180deg, #fffefb 0%, #f5f0e8 50%, #ebe6dd 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 1px 2px rgba(0,0,0,0.06);
    overflow: hidden;
}
/* Arco superior: corona redondeada abajo (hacia la encía) */
.diente-upper .diente-crown {
    border-radius: 6px 6px 10px 10px;
    border-bottom-width: 1.5px;
    border-bottom-color: #c9c4b8;
}
/* Arco inferior: corona redondeada arriba (hacia la encía) */
.diente-lower .diente-crown {
    border-radius: 10px 10px 6px 6px;
    border-top-width: 1.5px;
    border-top-color: #c9c4b8;
}

/* Número FDI debajo de la corona */
.diente-num {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--health-text);
    margin-top: 2px;
    line-height: 1;
    min-height: 14px;
}

/* Overlay de afectación (color del motivo) */
.diente-afeccion {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.85;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.diente-upper .diente-afeccion { border-radius: 4px 4px 8px 8px; }
.diente-lower .diente-afeccion { border-radius: 8px 8px 4px 4px; }

/* Alternativa: punto central (si se prefiere solo un indicador) */
.diente-afeccion.punto {
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ----- Odontograma SVG clínico ----- */
.odontograma-svg-container {
    width: 100%;
    overflow-x: auto;
    padding: 0.35rem;
    border: 1px solid var(--health-border);
    border-radius: 10px;
    background: #f8fcff;
}

.odontograma-svg-board {
    min-width: 680px;
}

.odo-row-wrap + .odo-row-wrap {
    margin-top: 0.65rem;
}

.odo-row-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--health-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.2rem;
}

.odo-row {
    display: grid;
    grid-template-columns: repeat(8, minmax(56px, 1fr));
    gap: 0.35rem;
}

.odo-tooth {
    border: 1px solid #dbeaf6;
    border-radius: 8px;
    background: #fff;
    padding: 4px 2px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.odo-tooth:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.18);
    border-color: var(--health-primary);
}

.odo-tooth-svg {
    width: 40px;
    height: 66px;
    display: block;
}

.odo-lower .odo-tooth-svg {
    transform: rotate(180deg);
}

.odo-root {
    fill: none;
    stroke: #d9d3c5;
    stroke-width: 3.1;
    stroke-linecap: round;
}

.odo-crown-base {
    fill: #ffffff;
    stroke: #d2c7b2;
    stroke-width: 1.2;
}

.odo-crown-fill {
    fill: transparent !important;
    opacity: 0;
}

.odo-groove {
    fill: none;
    stroke: #cfc5b2;
    stroke-width: 0.95;
    stroke-linecap: round;
    opacity: 0.9;
}

.odo-tooth.has-afeccion .odo-crown-fill {
    opacity: 0;
}

.odo-tooth-num {
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 700;
    color: var(--health-text);
}

.odo-tooth-name {
    margin-top: 2px;
    font-size: 0.58rem;
    line-height: 1.05;
    font-weight: 600;
    color: var(--health-text-muted);
    text-align: center;
    min-height: 1.2em;
}

.odo-marker-dot {
    stroke: #ffffff;
    stroke-width: 1.8;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.btn-afeccion.is-selected {
    border: 2px solid var(--health-primary);
    box-shadow: 0 0 0 2px var(--health-primary-light);
}

/* Referencias de afecciones compactas y horizontales */
.odontograma-ref-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    align-items: center;
}

.odontograma-ref-item {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    background: #f4fbff;
    border: 1px solid var(--health-border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
}

.odontograma-ref-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex: 0 0 auto;
}

.odontograma-ref-text {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--health-text);
    line-height: 1;
}

/* Pequeñas variaciones por tipo para parecerse más a odontograma profesional */
.odo-tooth.type-incisor .odo-tooth-svg { width: 34px; }
.odo-tooth.type-canine .odo-tooth-svg { width: 36px; }
.odo-tooth.type-premolar .odo-tooth-svg { width: 39px; }
.odo-tooth.type-molar .odo-tooth-svg { width: 42px; }
