/**
 * Mi Asistente Dental - Sistema de Diseño y Estilos Premium
 * Paleta Médica: Deep Slate, Dental Sky Blue, Teal y Emerald
 */

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #e0f2fe;
    --primary-50: #f0f9ff;
    
    --teal: #0d9488;
    --teal-hover: #0f766e;
    --teal-light: #ccfbf1;
    
    --slate-950: #020617;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    
    --emerald: #10b981;
    --emerald-light: #d1fae5;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --rose: #f43f5e;
    --rose-light: #ffe4e6;
    --indigo: #6366f1;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.25);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    color: var(--slate-800);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Layout Principal */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: 270px;
    background: var(--slate-900);
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 50;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
    flex-shrink: 0;
}
.brand-icon svg { width: 26px; height: 26px; fill: currentColor; }

.brand-text h1 {
    font-size: 16px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
    line-height: 1.2;
}
.brand-text span {
    font-size: 11px;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--slate-400);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.25) 0%, rgba(2, 132, 199, 0.05) 100%);
    color: #38bdf8;
    border-left: 3px solid var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 13px; font-weight: 700; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 11px; color: var(--slate-400); }

/* Contenido Principal */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

/* Barra Superior (Top Header) */
.top-header {
    background: white;
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-title-box h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--slate-900);
    letter-spacing: -0.4px;
}
.header-title-box p {
    font-size: 12px;
    color: var(--slate-500);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-teal {
    background: var(--teal);
    color: white;
}
.btn-teal:hover { background: var(--teal-hover); }

.btn-whatsapp {
    background: #25D366;
    color: white;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
}
.btn-whatsapp:hover {
    background: #1eb855;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
}

.btn-secondary {
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-200);
}
.btn-secondary:hover {
    background: var(--slate-200);
    color: var(--slate-900);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* Área de Vistas */
.content-body {
    padding: 32px;
    flex: 1;
}

/* Tarjetas y Contenedores */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

/* Grid de Métricas / KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--slate-300);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.kpi-icon svg { width: 26px; height: 26px; stroke-width: 2; }

.kpi-icon.blue { background: var(--primary-light); color: var(--primary); }
.kpi-icon.teal { background: var(--teal-light); color: var(--teal); }
.kpi-icon.emerald { background: var(--emerald-light); color: var(--emerald); }
.kpi-icon.amber { background: var(--amber-light); color: var(--amber); }

.kpi-info .val {
    font-size: 24px;
    font-weight: 800;
    color: var(--slate-900);
    line-height: 1.2;
}
.kpi-info .lbl {
    font-size: 13px;
    color: var(--slate-500);
    font-weight: 500;
    margin-top: 2px;
}

/* Tablas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: var(--slate-50);
    color: var(--slate-600);
    font-weight: 700;
    padding: 12px 18px;
    border-bottom: 1px solid var(--slate-200);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: var(--slate-50);
}

/* Badges de Estado */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.badge-confirmada { background: var(--emerald-light); color: #047857; }
.badge-pendiente { background: var(--amber-light); color: #b45309; }
.badge-atendida { background: var(--primary-light); color: #0369a1; }
.badge-cancelada { background: var(--rose-light); color: #be123c; }

/* Odontograma Estilos */
.odonto-canvas-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.odonto-toolbar {
    background: white;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.odonto-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.odonto-tools-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.odonto-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 130px;
}

.odonto-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-700);
    cursor: pointer;
    transition: var(--transition);
}

.odonto-tool-btn:hover {
    background: var(--slate-100);
    border-color: var(--slate-300);
}

.odonto-tool-btn.active {
    background: var(--slate-900);
    color: white;
    border-color: var(--slate-900);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
}

.tool-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.odonto-arch-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--slate-400);
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.odonto-arch {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding: 8px 0;
}

.odonto-quadrant {
    display: flex;
    gap: 8px;
}

.odonto-divider-v {
    width: 2px;
    height: 74px;
    background: var(--slate-200);
    border-radius: 2px;
}

.odonto-divider-h {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 10px 0;
}

.odonto-divider-h::before {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    height: 1px;
    background: var(--slate-200);
}

.odonto-divider-h span {
    background: white;
    padding: 0 14px;
    font-size: 10px;
    font-weight: 800;
    color: var(--slate-400);
    letter-spacing: 1.2px;
    position: relative;
}

.tooth-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}

.tooth-wrapper:hover {
    transform: scale(1.08);
}

.tooth-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--slate-700);
    padding: 2px 7px;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid var(--slate-200);
    margin-bottom: 6px;
    transition: var(--transition);
}

.tooth-num:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.tooth-svg {
    border-radius: 4px;
}

.tooth-surface {
    fill: #ffffff;
    stroke: #cbd5e1;
    stroke-width: 1.2;
    transition: fill 0.15s ease, stroke 0.15s ease;
    cursor: pointer;
}
    transition: fill 0.15s ease, stroke 0.15s ease;
    cursor: pointer;
}

.tooth-surface:hover {
    stroke: var(--primary);
    stroke-width: 2.5;
    filter: brightness(0.95);
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-card.modal-lg {
    max-width: 850px;
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--slate-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--slate-400);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--slate-800); }

.modal-body {
    padding: 28px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 28px;
    border-top: 1px solid var(--slate-100);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--slate-50);
}

/* Formularios */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-300);
    background: white;
    font-family: inherit;
    font-size: 14px;
    color: var(--slate-900);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Tabs */
.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--slate-200);
    margin-bottom: 24px;
    gap: 24px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-500);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
    font-weight: 700;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* Responsive */
@media (max-width: 992px) {
    .app-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
    }
    .top-header { padding: 0 16px; }
    .content-body { padding: 16px; }
}
