/* ============================================================
   DentalCare — Sistema de diseño global
   Paleta: Teal (#0D9488) + Ámbar (#F59E0B)
   Stack: MudBlazor 9.6 + Plus Jakarta Sans / Inter / JetBrains Mono
   ============================================================ */

/* ----------------------------------------------------------
   1. VARIABLES GLOBALES
   ---------------------------------------------------------- */
:root {
    --dc-primary:          #0D9488;
    --dc-primary-dark:     #0B7A70;
    --dc-primary-light:    #CCFBF1;
    --dc-secondary:        #F59E0B;
    --dc-surface:          #F8FAFC;
    --dc-surface-raised:   #FFFFFF;
    --dc-surface-overlay:  #F1F5F9;
    --dc-accent:           #EC4899;
    --dc-success:          #10B981;
    --dc-danger:           #EF4444;
    --dc-info:             #3B82F6;
    --dc-text-primary:     #0F172A;
    --dc-text-muted:       #64748B;
    --dc-border:           #E2E8F0;
    --dc-sidebar-w:        256px;
    --dc-sidebar-mini:     64px;
    --dc-topbar-h:         56px;
    --dc-radius-card:      16px;
    --dc-radius-btn:       10px;
    --dc-radius-input:     10px;
    --dc-shadow-card:      0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.08);
    --dc-shadow-modal:     0 24px 64px rgba(0,0,0,0.18);
    --dc-font-head:        'Plus Jakarta Sans', sans-serif;
    --dc-font-body:        'Inter', sans-serif;
    --dc-font-mono:        'JetBrains Mono', monospace;
    --dc-transition:       250ms cubic-bezier(.4,0,.2,1);
}

/* Modo oscuro: redefine las variables --dc-* para que la parte central,
   el appbar, el drawer, paneles, KPIs y tablas cambien de color junto con
   MudBlazor. El atributo data-theme lo fija MainLayout (y el script anti-flash). */
html[data-theme='dark'] {
    --dc-primary:          #14B8A6;
    --dc-primary-dark:     #0F766E;
    --dc-primary-light:    #134E4A;
    --dc-surface:          #0F172A;
    --dc-surface-raised:   #1E293B;
    --dc-surface-overlay:  #273549;
    --dc-text-primary:     #F1F5F9;
    --dc-text-muted:       #94A3B8;
    --dc-border:           #334155;
    --dc-shadow-card:      0 1px 3px rgba(0,0,0,0.45), 0 4px 16px rgba(0,0,0,0.55);
    --dc-shadow-modal:     0 24px 64px rgba(0,0,0,0.6);
    color-scheme: dark;
}

html[data-theme='dark'] body {
    background-color: var(--dc-surface);
    color: var(--dc-text-primary);
}

/* ----------------------------------------------------------
   2. BASE
   ---------------------------------------------------------- */
html, body {
    font-family: var(--dc-font-body);
    background-color: var(--dc-surface);
    color: var(--dc-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6 {
    font-family: var(--dc-font-head) !important;
}

/* ----------------------------------------------------------
   3. TRANSICIÓN DE PÁGINA
   ---------------------------------------------------------- */
.dc-page-fade {
    animation: dcFadeIn 200ms ease forwards;
}

@keyframes dcFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------
   4. OVERRIDES MUDBLAZOR — BORDES Y RADIOS
   ---------------------------------------------------------- */
.mud-button-root {
    border-radius: var(--dc-radius-btn) !important;
    font-family: var(--dc-font-body) !important;
    font-weight: 500 !important;
    letter-spacing: .01em !important;
}

.mud-input-outlined .mud-input-outlined-border,
.mud-input-outlined-input-shrink .mud-input-outlined-border {
    border-radius: var(--dc-radius-input) !important;
}

.mud-chip-root {
    border-radius: 999px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
}

/* ----------------------------------------------------------
   5. CARD / PAPER
   ---------------------------------------------------------- */
.mud-paper {
    border-radius: var(--dc-radius-card) !important;
    box-shadow: var(--dc-shadow-card) !important;
    border: 1px solid var(--dc-border);
}

.mud-dialog-paper {
    border-radius: var(--dc-radius-card) !important;
    box-shadow: var(--dc-shadow-modal) !important;
}

/* ----------------------------------------------------------
   6. APPBAR / TOPBAR
   ---------------------------------------------------------- */
.mud-appbar {
    border-bottom: 1px solid var(--dc-border) !important;
    box-shadow: none !important;
    backdrop-filter: blur(8px);
}

/* Chip de fecha en el topbar */
.dc-date-chip {
    font-family: var(--dc-font-body);
    font-size: .78rem;
    font-weight: 500;
    color: var(--dc-text-muted);
    background: var(--dc-surface-overlay);
    border: 1px solid var(--dc-border);
    border-radius: 8px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Buscador expandible */
.dc-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    transition: width var(--dc-transition);
}

.dc-search-wrap .mud-input-control {
    min-width: 0;
}

/* ----------------------------------------------------------
   7. SIDEBAR / DRAWER
   ---------------------------------------------------------- */
.mud-drawer {
    border-right: 1px solid var(--dc-border) !important;
    box-shadow: none !important;
}

/* Logo section */
.dc-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--dc-border);
    overflow: hidden;
    min-height: 64px;
}

.dc-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--dc-primary), var(--dc-primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.dc-logo-text {
    overflow: hidden;
    transition: opacity var(--dc-transition), width var(--dc-transition);
}

.dc-logo-text .dc-logo-name {
    font-family: var(--dc-font-head);
    font-weight: 700;
    font-size: .92rem;
    color: var(--dc-primary);
    white-space: nowrap;
}

.dc-logo-text .dc-logo-sub {
    font-size: .68rem;
    color: var(--dc-text-muted);
    white-space: nowrap;
}

/* Grupos de navegación */
.dc-nav-section {
    padding: 12px 16px 4px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dc-text-muted);
    transition: opacity var(--dc-transition);
    white-space: nowrap;
    overflow: hidden;
}

/* NavLinks */
.mud-nav-link {
    border-radius: 10px !important;
    margin: 2px 8px !important;
    font-family: var(--dc-font-body) !important;
    font-weight: 500 !important;
    font-size: .85rem !important;
    color: var(--dc-text-muted) !important;
    transition: background var(--dc-transition), color var(--dc-transition) !important;
}

.mud-nav-link:hover {
    background: var(--dc-surface-overlay) !important;
    color: var(--dc-text-primary) !important;
}

.mud-nav-link.active {
    background: var(--dc-primary-light) !important;
    color: var(--dc-primary) !important;
    border-left: 3px solid var(--dc-primary);
    font-weight: 600 !important;
}

.mud-nav-link.active .mud-icon-root {
    color: var(--dc-primary) !important;
}

/* Doctor info al fondo del sidebar */
.dc-doctor-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--dc-border);
    overflow: hidden;
}

.dc-doctor-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dc-primary-light), var(--dc-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--dc-font-head);
    font-weight: 700;
    font-size: .8rem;
    color: var(--dc-primary-dark);
    flex-shrink: 0;
}

.dc-doctor-info {
    overflow: hidden;
    transition: opacity var(--dc-transition);
}

.dc-doctor-info .dc-doctor-name {
    font-size: .8rem;
    font-weight: 600;
    color: var(--dc-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dc-doctor-info .dc-doctor-role {
    font-size: .7rem;
    color: var(--dc-text-muted);
    white-space: nowrap;
}

/* Ocultar textos en modo mini */
.dc-mini .dc-logo-text,
.dc-mini .dc-nav-section,
.dc-mini .dc-doctor-info {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.dc-mini .mud-nav-link {
    margin: 2px 4px !important;
    justify-content: center;
}

/* ----------------------------------------------------------
   8. KPI CARDS (dashboard)
   ---------------------------------------------------------- */
.dc-kpi {
    background: var(--dc-surface-raised);
    border-radius: var(--dc-radius-card);
    box-shadow: var(--dc-shadow-card);
    border: 1px solid var(--dc-border);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform var(--dc-transition), box-shadow var(--dc-transition);
}

.dc-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.dc-kpi::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: var(--dc-radius-card) var(--dc-radius-card) 0 0;
}

.dc-kpi-teal::before  { background: linear-gradient(90deg, var(--dc-primary), #14B8A6); }
.dc-kpi-amber::before { background: linear-gradient(90deg, var(--dc-secondary), #FCD34D); }
.dc-kpi-green::before { background: linear-gradient(90deg, var(--dc-success), #34D399); }
.dc-kpi-blue::before  { background: linear-gradient(90deg, var(--dc-info), #60A5FA); }

.dc-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dc-kpi-icon-teal  { background: var(--dc-primary-light); color: var(--dc-primary); }
.dc-kpi-icon-amber { background: #FEF3C7; color: var(--dc-secondary); }
.dc-kpi-icon-green { background: #D1FAE5; color: var(--dc-success); }
.dc-kpi-icon-blue  { background: #DBEAFE; color: var(--dc-info); }

.dc-kpi-value {
    font-family: var(--dc-font-head);
    font-size: 2rem;
    font-weight: 700;
    color: var(--dc-text-primary);
    line-height: 1.1;
}

.dc-kpi-mono {
    font-family: var(--dc-font-mono);
    font-size: 1.55rem;
    font-weight: 500;
    color: var(--dc-text-primary);
    line-height: 1.1;
}

.dc-kpi-label {
    font-size: .78rem;
    color: var(--dc-text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.dc-kpi-sub {
    font-size: .72rem;
    color: var(--dc-primary);
    font-weight: 600;
    margin-top: 6px;
}

/* ----------------------------------------------------------
   9. TIMELINE DE AGENDA
   ---------------------------------------------------------- */
.dc-timeline {
    position: relative;
    padding-left: 4px;
}

.dc-timeline-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
}

.dc-timeline-time {
    width: 52px;
    flex-shrink: 0;
    font-family: var(--dc-font-mono);
    font-size: .75rem;
    font-weight: 500;
    color: var(--dc-text-muted);
    padding-top: 14px;
    text-align: right;
}

.dc-timeline-dot {
    width: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 18px;
}

.dc-timeline-dot-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dc-timeline-dot-line {
    width: 2px;
    flex: 1;
    background: var(--dc-border);
    margin-top: 4px;
    min-height: 20px;
}

.dc-timeline-card {
    flex: 1;
    background: var(--dc-surface-raised);
    border: 1px solid var(--dc-border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: box-shadow var(--dc-transition), border-color var(--dc-transition);
}

.dc-timeline-card:hover {
    box-shadow: var(--dc-shadow-card);
    border-color: var(--dc-primary-light);
}

.dc-timeline-patient {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dc-timeline-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--dc-primary-light);
    color: var(--dc-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    font-family: var(--dc-font-head);
    flex-shrink: 0;
}

.dc-timeline-name {
    font-weight: 600;
    font-size: .85rem;
    color: var(--dc-text-primary);
}

.dc-timeline-treatment {
    font-size: .77rem;
    color: var(--dc-text-muted);
    margin-left: 36px;
}

/* ----------------------------------------------------------
   10. CHIPS DE ESTADO (citas)
   ---------------------------------------------------------- */
.dc-estado-programada  { background: #F1F5F9 !important; color: #475569 !important; }
.dc-estado-confirmada  { background: var(--dc-primary-light) !important; color: var(--dc-primary-dark) !important; }
.dc-estado-en-curso    { background: #FEF3C7 !important; color: #92400E !important; }
.dc-estado-completada  { background: #D1FAE5 !important; color: #065F46 !important; }
.dc-estado-cancelada   { background: #FEE2E2 !important; color: #991B1B !important; }
.dc-estado-noshow      { background: #FCE7F3 !important; color: #9D174D !important; }

/* ----------------------------------------------------------
   11. DATOS MONOESPACIADOS (importes, folios)
   ---------------------------------------------------------- */
.dc-mono {
    font-family: var(--dc-font-mono);
    font-weight: 500;
    letter-spacing: .02em;
}

/* ----------------------------------------------------------
   12. GREETING HEADER (dashboard)
   ---------------------------------------------------------- */
.dc-greeting {
    font-family: var(--dc-font-head);
    font-weight: 700;
    font-size: 1.55rem;
    color: var(--dc-text-primary);
}

.dc-greeting-sub {
    font-size: .85rem;
    color: var(--dc-text-muted);
    margin-top: 2px;
}

/* ----------------------------------------------------------
   13. SECCIÓN PANEL (card contenedor de sección)
   ---------------------------------------------------------- */
.dc-panel {
    background: var(--dc-surface-raised);
    border-radius: var(--dc-radius-card);
    box-shadow: var(--dc-shadow-card);
    border: 1px solid var(--dc-border);
    padding: 20px;
}

.dc-panel-title {
    font-family: var(--dc-font-head);
    font-weight: 600;
    font-size: .92rem;
    color: var(--dc-text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ----------------------------------------------------------
   14. LOGIN
   ---------------------------------------------------------- */
.dc-login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #F0FDFA 0%, #CCFBF1 60%, #99F6E4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dc-login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(13,148,136,0.15), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(204,251,241,0.6);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
}

.dc-login-split {
    display: flex;
    min-height: 100vh;
}

.dc-login-left {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.dc-login-right {
    flex: 1;
    background: linear-gradient(150deg, #0D9488 0%, #0B7A70 40%, #134e4a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.dc-login-right::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    top: -120px;
    right: -100px;
}

.dc-login-right::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    bottom: -60px;
    left: -60px;
}

.dc-login-tagline {
    font-family: var(--dc-font-head);
    color: rgba(255,255,255,0.95);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 16px;
}

.dc-login-tagline-sub {
    color: rgba(255,255,255,0.65);
    font-size: .95rem;
    line-height: 1.6;
    max-width: 340px;
}

@media (max-width: 768px) {
    .dc-login-right { display: none; }
    .dc-login-left  { flex: 1; padding: 24px; }
    .dc-login-card  { max-width: 100%; }
}

/* ----------------------------------------------------------
   15. TABLA DE DATOS — overrides MudDataGrid
   ---------------------------------------------------------- */
.mud-table-container {
    border-radius: 12px !important;
    overflow: hidden;
}

.mud-table thead th {
    font-family: var(--dc-font-body) !important;
    font-size: .74rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--dc-text-muted) !important;
    background: var(--dc-surface-overlay) !important;
}

.mud-table tbody td {
    font-size: .84rem !important;
}

.mud-table-row:hover {
    background: var(--dc-surface-overlay) !important;
}

/* ----------------------------------------------------------
   16. PORTAL (layout separado)
   ---------------------------------------------------------- */
.dc-portal-appbar {
    background: var(--dc-primary) !important;
}

/* ----------------------------------------------------------
   17. MAYÚSCULAS en inputs de captura
   ---------------------------------------------------------- */
.dc-mayusculas .mud-input-slot input,
.dc-mayusculas .mud-input-slot textarea {
    text-transform: uppercase;
}

/* ----------------------------------------------------------
   18. BLAZOR ERROR UI (mínimo)
   ---------------------------------------------------------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #FEF2F2;
    border-top: 2px solid var(--dc-danger);
    bottom: 0;
    box-sizing: border-box;
    color: var(--dc-danger);
    display: none;
    font-family: var(--dc-font-body);
    font-size: .85rem;
    left: 0;
    padding: 10px 20px;
    position: fixed;
    width: 100%;
    z-index: 9999;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 14px;
    top: 8px;
}

.blazor-error-boundary {
    background: #FEF2F2;
    border: 1px solid var(--dc-danger);
    border-radius: 10px;
    color: var(--dc-danger);
    padding: 16px 20px;
}

/* ----------------------------------------------------------
   19. LOADING PROGRESS (splash)
   ---------------------------------------------------------- */
.loading-progress {
    position: absolute;
    display: block;
    width: 5rem;
    height: 5rem;
    inset: 25vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #CCFBF1;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--dc-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-family: var(--dc-font-body);
    font-size: .78rem;
    color: var(--dc-text-muted);
    inset: calc(25vh + 5.5rem) 0 auto 0;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Cargando...");
}
