/* ==========================================================================
   mapainterior.com.mx — Escritorio del Profesional
   Panel de gestión clínica para psicólogos, psicoterapeutas y psiquiatras
   ========================================================================== */

:root {
    --dash-bg: #f5f4ef;
    --dash-sidebar-bg: #1e2530;
    --dash-sidebar-hover: #2a3444;
    --dash-surface: #ffffff;
    --dash-surface-alt: #fbfaf8;
    --dash-border: #e2dbcf;
    --dash-border-subtle: #eee8de;
    
    --dash-primary: #1e3a5f;
    --dash-primary-light: #eaf0f8;
    --dash-primary-hover: #162c49;
    
    --dash-accent: #a35d38;
    --dash-accent-light: #fbeee7;
    --dash-accent-hover: #884b2c;
    
    --dash-success: #287243;
    --dash-success-bg: #eaf6ed;
    --dash-warning: #b45309;
    --dash-warning-bg: #fef3c7;
    
    --dash-text: #2c333f;
    --dash-text-muted: #677284;
    --dash-text-dark: #121822;
    --dash-text-white: #f8fafc;
    
    --dash-shadow-sm: 0 1px 3px rgba(30, 37, 48, 0.05);
    --dash-shadow-md: 0 4px 14px rgba(30, 37, 48, 0.08);
    --dash-shadow-lg: 0 12px 30px rgba(30, 37, 48, 0.12);
    
    --dash-radius-sm: 6px;
    --dash-radius-md: 10px;
    --dash-radius-lg: 16px;
    
    --dash-font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--dash-font);
    background-color: var(--dash-bg);
    color: var(--dash-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Layout del escritorio */
.dash-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.dash-sidebar {
    width: 270px;
    background-color: var(--dash-sidebar-bg);
    color: var(--dash-text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.dash-brand {
    padding: 1.75rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.dash-brand-icon {
    width: 24px;
    height: 24px;
    color: #e59871;
}

.dash-brand-sub {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-top: 0.35rem;
}

.dash-pilot-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: rgba(229, 152, 113, 0.15);
    color: #f1b392;
    border-radius: 9999px;
    margin-top: 0.75rem;
    border: 1px solid rgba(229, 152, 113, 0.25);
}

.dash-nav {
    flex: 1;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
}

.dash-nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.6rem 0.75rem 0.35rem;
    font-weight: 700;
}

.dash-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    color: #cbd5e1;
    border-radius: var(--dash-radius-sm);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dash-nav-item:hover {
    background-color: var(--dash-sidebar-hover);
    color: white;
}

.dash-nav-item.active {
    background-color: var(--dash-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dash-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.dash-nav-badge {
    margin-left: auto;
    font-size: 0.75rem;
    background: var(--dash-accent);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-weight: 700;
}

.dash-user-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dash-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #334155;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.dash-user-info {
    flex: 1;
    overflow: hidden;
}

.dash-user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

/* Contenido Principal */
.dash-main {
    flex: 1;
    margin-left: 270px;
    padding: 2.25rem 2.5rem 4rem;
    max-width: 1300px;
}

/* Header superior */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.dash-page-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--dash-text-dark);
    letter-spacing: -0.015em;
}

.dash-page-desc {
    color: var(--dash-text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.dash-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--dash-radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background-color: var(--dash-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.18);
}
.btn-primary:hover {
    background-color: var(--dash-primary-hover);
    transform: translateY(-1px);
}

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

.btn-outline {
    background-color: var(--dash-surface);
    color: var(--dash-text);
    border-color: var(--dash-border);
}
.btn-outline:hover {
    background-color: var(--dash-surface-alt);
    border-color: var(--dash-text-muted);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    border-radius: var(--dash-radius-sm);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.25rem;
}

.stat-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    padding: 1.5rem;
    box-shadow: var(--dash-shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: var(--dash-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon-primary { background: var(--dash-primary-light); color: var(--dash-primary); }
.stat-icon-accent { background: var(--dash-accent-light); color: var(--dash-accent); }
.stat-icon-success { background: var(--dash-success-bg); color: var(--dash-success); }
.stat-icon-warning { background: var(--dash-warning-bg); color: var(--dash-warning); }

.stat-val {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dash-text-dark);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* Cards y contenedores */
.dash-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    padding: 1.75rem;
    margin-bottom: 2rem;
    box-shadow: var(--dash-shadow-sm);
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dash-text-dark);
}

/* Buscador y filtros */
.dash-filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.dash-search-input {
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    font-size: 0.9rem;
    min-width: 250px;
    font-family: inherit;
    background: var(--dash-surface);
}

.dash-search-input:focus {
    outline: none;
    border-color: var(--dash-primary);
}

/* Tablas */
.dash-table-wrap {
    overflow-x: auto;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}

.dash-table th {
    padding: 0.85rem 1rem;
    background-color: var(--dash-surface-alt);
    color: var(--dash-text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--dash-border);
}

.dash-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--dash-border-subtle);
    vertical-align: middle;
}

.dash-table tr:hover td {
    background-color: rgba(245, 244, 239, 0.4);
}

/* Badges de estado */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-pill.success { background: var(--dash-success-bg); color: var(--dash-success); }
.status-pill.warning { background: var(--dash-warning-bg); color: var(--dash-warning); }
.status-pill.info { background: var(--dash-primary-light); color: var(--dash-primary); }

/* Grid de los 7 mapas */
.instrumentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 1.5rem;
}

.instrumento-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.instrumento-card:hover {
    border-color: var(--dash-primary);
    box-shadow: var(--dash-shadow-md);
    transform: translateY(-2px);
}

.instrumento-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dash-accent);
    margin-bottom: 0.5rem;
}

.instrumento-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dash-primary);
    margin-bottom: 0.6rem;
}

.instrumento-desc {
    font-size: 0.9rem;
    color: var(--dash-text);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.instrumento-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--dash-border-subtle);
    font-size: 0.82rem;
    color: var(--dash-text-muted);
}

/* Modales */
.dash-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 24, 34, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.dash-modal-backdrop.active {
    display: flex;
}

.dash-modal {
    background: var(--dash-surface);
    border-radius: var(--dash-radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--dash-shadow-lg);
    border: 1px solid var(--dash-border);
}

.dash-modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--dash-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dash-text-dark);
}

.dash-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--dash-text-muted);
    padding: 0.25rem;
    line-height: 1;
}

.dash-modal-body {
    padding: 1.75rem;
}

.dash-modal-footer {
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--dash-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Formularios en modal */
.modal-form-group {
    margin-bottom: 1.25rem;
}

.modal-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--dash-text-dark);
}

.modal-input, .modal-select, .modal-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--dash-surface);
}

.modal-input:focus, .modal-select:focus, .modal-textarea:focus {
    outline: none;
    border-color: var(--dash-primary);
}

/* Visualizador de reporte clínico */
.reporte-sheet {
    background: #ffffff;
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    padding: 2.25rem;
}

.reporte-badge-type {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--dash-accent);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.reporte-box {
    background: var(--dash-surface-alt);
    border-left: 3px solid var(--dash-primary);
    padding: 1.25rem;
    border-radius: 0 var(--dash-radius-sm) var(--dash-radius-sm) 0;
    margin: 1.25rem 0;
}

.reporte-box.accent {
    border-left-color: var(--dash-accent);
    background: var(--dash-accent-light);
}

.reporte-section-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dash-text-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reporte-question-list {
    list-style: none;
    padding-left: 0;
}

.reporte-question-list li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.reporte-question-list li::before {
    content: "•";
    color: var(--dash-accent);
    font-weight: bold;
    font-size: 1.3rem;
    position: absolute;
    left: 0.3rem;
    top: -0.2rem;
}

/* Generador de enlaces */
.link-box {
    background: var(--dash-surface-alt);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.link-text {
    font-family: monospace;
    font-size: 0.88rem;
    color: var(--dash-primary);
    word-break: break-all;
}

/* Feedback de copiado */
.toast-msg {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dash-sidebar-bg);
    color: white;
    padding: 0.85rem 1.5rem;
    border-radius: var(--dash-radius-md);
    box-shadow: var(--dash-shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    z-index: 2000;
    border-left: 4px solid var(--dash-accent);
}

/* Responsividad */
@media (max-width: 900px) {
    .dash-sidebar {
        transform: translateX(-100%);
    }
    .dash-sidebar.open {
        transform: translateX(0);
    }
    .dash-main {
        margin-left: 0;
        padding: 1.5rem 1.25rem 3rem;
    }
    .mobile-menu-btn {
        display: inline-flex !important;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--dash-border);
    padding: 0.5rem;
    border-radius: var(--dash-radius-sm);
    cursor: pointer;
}
