/**
 * SISTEMA DE COMUNICACIÓN VISUAL INSTITUCIONAL
 * Estilos del Panel Administrativo (100% Autónomo - Sin dependencias externas)
 */

:root {
  --primary: #1e3a8a;
  --primary-hover: #1e40af;
  --secondary: #0284c7;
  --accent: #f59e0b;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --sidebar-w: 260px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
}

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout General */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-w);
  background-color: #0f172a;
  color: #f1f5f9;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  background-color: #020617;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.school-badge {
  background: var(--primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
}

.menu-category {
  padding: 0.5rem 1.25rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.25rem;
  color: #cbd5e1;
  font-size: 0.9rem;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background-color: #1e293b;
  color: #ffffff;
  text-decoration: none;
  border-left-color: var(--secondary);
}

.sidebar-menu svg {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #1e293b;
  background-color: #0b1120;
}

.user-profile-brief {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #334155;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Contenido Principal */
.admin-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.admin-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-main {
  padding: 1.5rem;
  flex: 1;
}

/* Tarjetas */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
}

.card-body {
  padding: 1.25rem;
}

/* Grillas de estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.stat-icon.blue { background-color: #2563eb; }
.stat-icon.green { background-color: #16a34a; }
.stat-icon.amber { background-color: #d97706; }
.stat-icon.red { background-color: #dc2626; }
.stat-icon.purple { background-color: #9333ea; }
.stat-icon.cyan { background-color: #0891b2; }

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

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

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

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

.data-table th {
  background-color: #f1f5f9;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 1px solid var(--border-color);
}

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

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
}

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

.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.775rem; }

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #334155;
}

.form-control,
.form-select,
textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background-color: #ffffff;
  color: #1e293b;
  outline: none;
}

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

.form-help {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

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

/* Alertas */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.alert-success { background-color: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: 8px;
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

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

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* Responsive */
@media (max-width: 900px) {
  .admin-wrapper { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}
