/* ==========================================================================
   1. LAYOUT PRINCIPAL DEL DASHBOARD (OFFICE/ADMIN)
   ========================================================================== */
.layout-admin { height: 100vh; overflow: hidden; display: flex; flex-direction: column; background-color: #f8fafc; }
.layout-main { display: flex; min-height: calc(100vh - 65px); flex: 1; overflow: hidden; }

/* Topbar del Dashboard */
.topbar { display: flex; justify-content: space-between; align-items: center; height: 65px; background: white; padding: 0 2rem; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; z-index: 10; position: relative; }
.logo-container h2 { margin: 0; color: var(--primary-color, #2563eb); font-size: 1.4rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }

/* Sidebar del Dashboard */
.sidebar { width: 250px; background: white; border-right: 1px solid #e2e8f0; padding: 2rem 0; flex-shrink: 0; overflow-y: auto; transition: transform 0.3s ease; }
.sidebar-heading, .sidebar-title { padding: 0 2rem; font-size: 0.75rem; color: #94a3b8; font-weight: 700; letter-spacing: 1px; margin-bottom: 1rem; text-transform: uppercase; margin-top: 0; }
.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li a { display: block; padding: 0.75rem 2rem; color: #475569; text-decoration: none; font-weight: 600; font-size: 0.95rem; border-left: 4px solid transparent; transition: all 0.2s; }
.sidebar-menu li a:hover, .sidebar-menu li a.active { background: #f1f5f9; color: var(--primary-color, #2563eb); border-left-color: var(--primary-color, #2563eb); }

/* Área de Contenido del Dashboard */
.content, .main-content { flex-grow: 1; padding: 2.5rem; overflow-y: auto; background: transparent; width: calc(100% - 250px); }
.admin-container, .dashboard-container { max-width: 100%; }

/* Cabecera con botones a la derecha (Ej: Título + Botón Crear) */
.header-actions { margin-bottom: 2rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.header-actions h1 { margin: 0; color: #1e293b; font-size: 1.8rem; }

/* Cabecera simple con subtítulo debajo (Ej: Dashboard) */
.dashboard-header { margin-bottom: 2rem; display: block; }
.dashboard-header h1 { margin: 0; color: #1e293b; font-size: 1.8rem; line-height: 1.2; }
.dashboard-header p { color: #64748b; margin-top: 0.5rem; margin-bottom: 0; font-size: 0.95rem; }

/* Fix para el menú superior */
.top-nav-links { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.top-nav-links a { text-decoration: none; color: #475569; font-weight: 600; font-size: 0.9rem; transition: color 0.2s; }
.top-nav-links a:hover { color: var(--primary-color, #2563eb); }

/* ==========================================================================
   2. TABLAS Y BOTONES DE ACCIÓN (CRUD)
   ========================================================================== */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.data-table th, .data-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.95rem; }
.data-table th { background: #f8fafc; font-weight: 600; color: #475569; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }

.action-group { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.btn-sm { padding: 0.35rem 0.75rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center; }

.btn-edit { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.btn-edit:hover { background: #dbeafe; transform: translateY(-1px); }
.btn-warning { background: #fef3c7; color: #d97706; border-color: #fde68a; }
.btn-warning:hover { background: #fde68a; transform: translateY(-1px); }
.btn-delete { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-delete:hover { background: #fecaca; transform: translateY(-1px); }

/* Badges de Tablas */
.badge { padding: 0.25rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: bold; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-action { background: #e0e7ff; color: #4f46e5; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: bold; letter-spacing: 0.5px; }

/* ==========================================================================
   3. ESTADÍSTICAS Y ACCESOS RÁPIDOS
   ========================================================================== */
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2.5rem; }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }

.stat-card { background: white; padding: 1.5rem; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); border-left: 4px solid var(--primary-color, #2563eb); }
.stat-card.green { border-left-color: #10b981; }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-title { font-size: 0.85rem; color: #64748b; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.5rem; font-weight: 700; color: #1e293b; margin: 0; line-height: 1; }

.section-title { font-size: 1.1rem; color: #1e293b; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid #e2e8f0; }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2.5rem; }
.action-btn { display: flex; align-items: center; justify-content: center; padding: 1rem; background: white; border: 1px solid #cbd5e1; border-radius: 8px; text-decoration: none; color: #334155; font-weight: 600; transition: all 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.action-btn:hover { border-color: var(--primary-color, #2563eb); color: var(--primary-color, #2563eb); transform: translateY(-2px); box-shadow: 0 4px 6px rgba(37,99,235,0.1); }

/* ==========================================================================
   4. FORMULARIOS DE BACKOFFICE (CRUD)
   ========================================================================== */
.form-wrapper { width: 100%; padding-top: 1rem; }
.form-container { width: 100%; max-width: 550px; background: white; padding: 2.5rem; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); box-sizing: border-box; margin: 0 auto 2rem auto; }
.form-container h2 { margin-top: 0; margin-bottom: 2rem; color: #1e293b; font-size: 1.5rem; text-align: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.5rem; }

.btn-submit { width: 100%; background: var(--primary-color, #2563eb); color: white; border: none; padding: 1rem; font-size: 1rem; border-radius: 8px; font-weight: bold; cursor: pointer; transition: background 0.2s; margin-top: 0.5rem; }
.btn-submit:hover { filter: brightness(0.9); }
.btn-submit.btn-warning { background: #d97706; color: white; }
.btn-submit.btn-warning:hover { background: #b45309; }
.btn-cancel { display: block; text-align: center; margin-top: 1rem; color: #64748b; text-decoration: none; font-size: 0.9rem; }
.btn-cancel:hover { color: #334155; text-decoration: underline; }

/* Estilos de Split Screen Login (Office Auth) */
.auth-layout { display: flex; min-height: 100vh; width: 100%; background-color: #ffffff; color: #333333; }
.auth-form-section { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem; width: 100%; }
.auth-form-container { width: 100%; max-width: 420px; }
.auth-header { text-align: center; margin-bottom: 2.5rem; }
.auth-logo { max-height: 60px; margin-bottom: 1rem; }
.auth-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; font-size: 0.9rem; }
.auth-image-section { display: none; }

/* ==========================================================================
   5. UTILIDADES DEL OFFICE (CERO ESTILOS EN LÍNEA)
   ========================================================================== */
.sidebar-menu li a { display: flex; align-items: center; gap: 0.5rem; }
.top-nav-links a { display: flex; align-items: center; gap: 0.4rem; }
.office-main { display: flex; flex-direction: column; min-height: 100%; }
.content-wrapper { flex-grow: 1; }

@media (min-width: 768px) {
    .auth-layout { display: grid; grid-template-columns: 1fr 1fr; }
    .auth-image-section { display: block; background-color: #f3f4f6; background-size: cover; background-position: center; position: relative; }
    .auth-image-section::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.4), transparent); }
}

@media (max-width: 768px) {
    .main-content, .content { width: 100%; padding: 1.5rem; }
    .sidebar { position: absolute; left: 0; top: 0; bottom: 0; z-index: 100; transform: translateX(-100%); box-shadow: 4px 0 15px rgba(0,0,0,0.1); }
    .sidebar.active { transform: translateX(0); }
}