/* === DISEÑO "DARK MEDICAL FUTURE" === */
:root {
    --bg-dark: #131517;       /* Fondo casi negro */
    --card-dark: #1E2226;     /* Fondo de tarjetas */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    
    /* Degradados de la imagen */
    --gradient-teal: linear-gradient(135deg, #2dd4bf 0%, #0ea5e9 100%); /* Verde a Azul */
    --gradient-blue: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); /* Azul a Morado */
    --gradient-green: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    
    --radius-xl: 20px;
    --radius-md: 12px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
}

/* === NAVBAR === */
.navbar-custom {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1030 !important;
    background-color: #0f172a !important;  /* dark slate */
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff !important;
}
.navbar-custom .nav-link {
    color: rgba(255,255,255,0.85) !important;
    transition: background-color 0.25s ease, color 0.25s ease;
    border-radius: 8px;
    padding: 0.45rem 0.9rem !important;
    margin: 0 2px;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus {
    background-color: rgba(59, 130, 246, 0.25) !important;  /* azul translúcido al pasar el mouse */
    color: #fff !important;
}
.navbar-custom form button.nav-link:hover {
    background-color: rgba(220, 53, 69, 0.3) !important;  /* rojo translúcido en "Cerrar sesión" */
}

/* === TOAST MESSAGES (notificaciones flotantes) === */
.toast-stack {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    width: calc(100% - 40px);
}
.toast-message {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    background: #1e293b;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);
    border-left: 6px solid #3b82f6;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.toast-success { border-left-color: #22c55e; background: linear-gradient(135deg, #1e293b 0%, #14532d 100%); }
.toast-error   { border-left-color: #ef4444; background: linear-gradient(135deg, #1e293b 0%, #7f1d1d 100%); }
.toast-warning { border-left-color: #f59e0b; background: linear-gradient(135deg, #1e293b 0%, #78350f 100%); }
.toast-info    { border-left-color: #3b82f6; background: linear-gradient(135deg, #1e293b 0%, #1e3a8a 100%); }

.toast-icon {
    font-size: 1.75rem;
    line-height: 1;
    flex-shrink: 0;
}
.toast-success .toast-icon { color: #4ade80; }
.toast-error   .toast-icon { color: #f87171; }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info    .toast-icon { color: #60a5fa; }

.toast-body { flex-grow: 1; }
.toast-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.toast-text {
    font-size: 0.92rem;
    color: rgba(255,255,255,0.92);
    line-height: 1.4;
}
.toast-close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    transition: color 0.2s;
}
.toast-close:hover { color: #fff; }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255,255,255,0.4);
    transform-origin: left;
    animation: toastProgress 6s linear forwards;
}

.toast-fadeout {
    animation: toastSlideOut 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastSlideOut {
    to { transform: translateX(120%); opacity: 0; }
}
@keyframes toastProgress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* === BOTONES ACCIONES RÁPIDAS === */
.btn-quick-action {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.85));
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;          /* píldora */
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    font-size: 0.95rem;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.btn-quick-action:hover {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.7), rgba(30, 64, 175, 0.7));
    color: #fff !important;
    border-color: rgba(94, 234, 212, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.4);
}
.btn-quick-action i {
    margin-right: 0.4rem;
}

/* === TARJETAS GENERALES === */
.card {
    background-color: var(--card-dark);
    border: 1px solid rgba(255,255,255,0.05); /* Borde sutil */
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    color: white;
    margin-bottom: 20px;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 1.5rem;
}

/* === TARJETAS DEL DASHBOARD (KPIs) === */
/* Estilo para las tarjetas pequeñas de arriba */
.dashboard-widget {
    border-radius: var(--radius-xl);
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: none;
}

/* Aplicamos los degradados a las tarjetas específicas */
.bg-primary.dashboard-widget { background: var(--gradient-teal) !important; }
.bg-success.dashboard-widget { background: var(--gradient-green) !important; }
.bg-info.dashboard-widget { background: var(--gradient-blue) !important; }

.dashboard-widget h2 {
    font-size: 3rem;
    font-weight: 700;
}
.dashboard-widget h6 {
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    font-size: 0.8rem;
}

/* === BOTONES REDONDOS === */
.btn {
    border-radius: 50px; /* Estilo píldora */
    padding: 10px 25px;
    font-weight: 600;
    text-transform: none;
    border: none;
}

.btn-primary {
    background: var(--gradient-teal);
    box-shadow: 0 4px 15px rgba(45, 212, 191, 0.4); /* Resplandor */
}
.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-secondary, .btn-outline-secondary {
    background-color: #2D3339;
    color: white;
    border: none;
}

/* === TABLAS EN MODO OSCURO === */
.table {
    color: var(--text-secondary);
}
.table thead th {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.table td {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.table-hover tbody tr:hover {
    color: white;
    background-color: rgba(255,255,255,0.05);
}

/* === FORMULARIOS OSCUROS === */
.form-control, .form-select {
    background-color: #0d0f11;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: var(--radius-md);
    padding: 12px;
}
.form-control:focus {
    background-color: #0d0f11;
    color: white;
    border-color: #2dd4bf; /* Color Teal al enfocar */
    box-shadow: 0 0 0 0.25rem rgba(45, 212, 191, 0.2);
}

textarea[name="signos_alarma"] {
    resize: none;
    border-left: 5px solid #dc3545; /* Un borde rojo para resaltar importancia */
    font-style: italic;
}

input[name="proxima_cita"] {
    border-left: 5px solid #0d6efd;
}

/* Mejora la apariencia del botón de salida */
#logout-form button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* === SECCIONES CON FONDO CLARO (formularios) === */
.bg-light, .bg-light label, .bg-light p, .bg-light span, .bg-light small {
    color: #212529 !important;
}
.bg-light .form-control, .bg-light .form-select {
    background-color: #ffffff;
    color: #212529;
    border-color: #dee2e6;
}
.bg-light .form-control:focus, .bg-light .form-select:focus {
    background-color: #ffffff;
    color: #212529;
}
/* === ACCIONES RÁPIDAS: grilla de tiles uniformes (reutilizable) === */
.qa-wrap{
    background: var(--card-dark);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.qa-title{
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: #94a3b8; margin-bottom: .9rem;
}
.qa-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
}
.qa-tile{
    display: flex; align-items: center; gap: .75rem;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 14px; padding: .9rem;
    text-decoration: none; color: #cbd5e1 !important;
    transition: all .18s ease;
}
.qa-tile:hover{
    border-color: rgba(45,212,191,.5);
    background: rgba(45,212,191,.08);
    transform: translateY(-2px);
    color: #fff !important;
}
.qa-ic{
    width: 42px; height: 42px; border-radius: 11px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem; background: var(--gradient-teal); color: #fff; flex-shrink: 0;
}
.qa-label{ font-size: .92rem; font-weight: 600; line-height: 1.15; display: block; }
.qa-sub{ font-size: 11px; color: #94a3b8; }
.qa-tile.primary{ background: rgba(45,212,191,.10); border-color: rgba(45,212,191,.35); }

/* === input-group y card-footer coherentes con el tema oscuro === */
.input-group-text{
    background-color: #0d0f11;
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
}
.card-footer{
    background-color: transparent;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* === Legibilidad de textos atenuados sobre el tema oscuro === */
.text-muted{ color: #94a3b8 !important; }        /* gris claro legible */
.text-white-50{ color: rgba(255,255,255,.65) !important; }
.bg-light .text-muted{ color: #6c757d !important; } /* en secciones claras, gris estándar */

/* === Modales coherentes con el tema oscuro === */
.modal-content{
    background-color: #1E2226;
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
}
.modal-header, .modal-footer{ border-color: rgba(255,255,255,0.08); }

/* === ODONTOGRAMA === */
.odo-wrap{ background:#0e1613; border:1px solid rgba(255,255,255,.1); border-radius:12px; padding:1rem; }
.odo-legend{ display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1rem; }
.odo-tool{ display:inline-flex; align-items:center; gap:.35rem; padding:.3rem .6rem; border-radius:999px;
    border:1px solid rgba(255,255,255,.15); background:#131517; color:#cbd5e1; cursor:pointer; font-size:.78rem; }
.odo-tool.active{ outline:2px solid #22c55e; outline-offset:1px; color:#fff; }
.odo-swatch{ width:14px; height:14px; border-radius:3px; border:1px solid rgba(255,255,255,.3); display:inline-block; }
.odo-arch{ display:flex; flex-direction:column; gap:.6rem; align-items:center; overflow-x:auto; padding:.25rem; }
.odo-row{ display:flex; gap:3px; }
.odo-gap{ width:14px; flex:0 0 auto; }
.tooth{ width:30px; text-align:center; user-select:none; }
.tooth.clickable{ cursor:pointer; }
.tooth .tnum{ font-size:9px; color:#94a3b8; display:block; margin-bottom:2px; }
.tooth .tbox{ width:26px; height:34px; border:1px solid rgba(255,255,255,.25); border-radius:5px;
    display:block; margin:0 auto; background:#1b1f24; transition:.1s; position:relative; }
.tooth.clickable:hover .tbox{ border-color:#22c55e; }
.tooth .tbox.is-ausente::after{ content:'✕'; position:absolute; inset:0; display:flex; align-items:center;
    justify-content:center; color:#f87171; font-size:15px; font-weight:bold; }
