/* base.css — Estilos globales LugorNet */

/* ─── Variables de identidad Lugor ─────────────────────────────────────── */
:root {
  --color-primary: #002060;
  --color-primary-dark: #001640;
  --color-secondary: #1F4E8C;
  --color-surface-accent: #DCE6F1;

  --color-background: #FFFFFF;
  --color-surface: #EEF2F6;
  --color-text: #263238;
  --color-text-muted: #667085;
  --color-border: #DCE3EA;

  --color-status-danger: #E23B3B;
  --color-status-warning: #F5A623;
  --color-status-success: #2FA84F;

  --font-family: "Inter", Arial, sans-serif;

  --sidebar-width: 240px;
  --header-height: 58px;
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
  --transition: 0.18s ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-family);
  background: var(--color-surface);
  color: var(--color-text);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ─── Layout principal ─────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-link { text-decoration: none; }
.brand-text {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.brand-net { color: #60A5FA; }

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1.1rem;
  padding: 0.2rem;
  cursor: pointer;
}

.sidebar-nav { flex: 1; padding: 0.75rem 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.1rem;
  color: rgba(255,255,255,.82);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  margin: 0 0.5rem 0.1rem 0;
  transition: background var(--transition), color var(--transition);
}
.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}
.nav-item.active { background: rgba(255,255,255,.18); }
.nav-icon { flex-shrink: 0; opacity: .9; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 0.85rem 1rem;
}
.user-info { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--color-secondary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.user-details { min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: rgba(255,255,255,.6); }
.btn-logout {
  display: flex; align-items: center; gap: 0.4rem;
  background: none; border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.75); border-radius: var(--border-radius-sm);
  padding: 0.35rem 0.75rem; font-size: 0.78rem; width: 100%;
  transition: background var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }
.logout-form { width: 100%; }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}

.app-body {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky; top: 0;
  height: var(--header-height);
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--color-text-muted); padding: 0.25rem;
}

.page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
}

.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.header-user-badge {
  font-size: 0.72rem; font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
}

.app-main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1280px;
  width: 100%;
}

.app-footer {
  padding: 0.75rem 1.5rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

/* ─── Botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-surface-accent); }
.btn-ghost { background: transparent; border-color: var(--color-border); color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface); }
.btn-danger { background: var(--color-status-danger); color: #fff; border-color: var(--color-status-danger); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-xs { padding: 0.15rem 0.45rem; font-size: 0.72rem; }
.btn-lg { padding: 0.7rem 1.4rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ─── Formularios ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--color-text); }
.form-hint { font-size: 0.75rem; color: var(--color-text-muted); }
.form-input, .form-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  background: var(--color-background);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(31,78,140,.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; padding-top: 1rem; }
.req { color: var(--color-status-danger); }
.char-count { font-size: 0.7rem; color: var(--color-text-muted); margin-left: 0.5rem; }
.checkbox-label { flex-direction: row; align-items: center; gap: 0.5rem; cursor: pointer; }

/* ─── Alertas ────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  border: 1px solid;
  margin-bottom: 1rem;
}
.alert-danger { background: #FFF2F2; border-color: #FFC5C5; color: #991B1B; }
.alert-success { background: #F0FDF4; border-color: #86EFAC; color: #166534; }
.alert-info { background: #EFF6FF; border-color: #93C5FD; color: #1E40AF; }
.alert-warning { background: #FFFBEB; border-color: #FCD34D; color: #92400E; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-primary { background: var(--color-surface-accent); color: var(--color-primary); }
.badge-success, .status-ok .badge { background: #D1FAE5; color: #065F46; }
.badge-danger, .status-danger .badge { background: #FEE2E2; color: #991B1B; }
.badge-warning, .status-warning .badge { background: #FEF3C7; color: #92400E; }
.badge-info { background: #DBEAFE; color: #1E40AF; }
.badge-muted { background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ─── Semáforo (estado de cumplimiento) ─────────────────────────────────── */
.status-ok { --status-color: var(--color-status-success); }
.status-warning { --status-color: var(--color-status-warning); }
.status-danger { --status-color: var(--color-status-danger); }

/* ─── Barra de progreso ─────────────────────────────────────────────────── */
.kpi-progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.4rem 0 0.2rem;
}
.kpi-progress-bar {
  height: 100%;
  background: var(--status-color, var(--color-primary));
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ─── Tablas ─────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--color-surface); }
.data-table tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-success { color: var(--color-status-success); }
.text-danger { color: var(--color-status-danger); }
.font-mono { font-variant-numeric: tabular-nums; }
.font-medium { font-weight: 500; }

/* ─── Secciones ──────────────────────────────────────────────────────────── */
.section-block {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.block-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.6rem; color: var(--color-text); }

/* ─── Data stamp ─────────────────────────────────────────────────────────── */
.data-stamp {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: var(--color-text-muted);
  margin-bottom: 1rem;
}

/* ─── Estado vacío ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--color-text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--color-text); }
.empty-msg { font-size: 0.875rem; }

/* ─── Filtros ────────────────────────────────────────────────────────────── */
.filters-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.filters-bar .form-select { width: auto; }

/* ─── Noticias / cartelera ───────────────────────────────────────────────── */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.news-card {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  position: relative;
}
.news-card:hover { box-shadow: var(--shadow-md); }
.news-card.pinned { border-left: 3px solid var(--color-primary); }
.pinned-badge {
  position: absolute; top: 0.5rem; right: 0.5rem;
  font-size: 0.68rem; font-weight: 600;
  background: var(--color-primary); color: #fff;
  padding: 0.1rem 0.4rem; border-radius: 999px;
}
.news-img-wrap { height: 160px; overflow: hidden; }
.news-img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.news-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.news-area { font-size: 0.72rem; font-weight: 600; color: var(--color-secondary); }
.news-date { font-size: 0.72rem; color: var(--color-text-muted); margin-left: auto; }
.news-views { font-size: 0.72rem; color: var(--color-text-muted); }
.news-title { font-size: 0.9rem; font-weight: 600; line-height: 1.35; }
.news-link { color: var(--color-text); }
.news-link:hover { color: var(--color-primary); text-decoration: none; }
.news-desc { font-size: 0.8rem; color: var(--color-text-muted); flex: 1; }
.news-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.news-author { font-size: 0.72rem; color: var(--color-text-muted); }
.inline-form { display: inline; }

/* ─── Formulario centrado ────────────────────────────────────────────────── */
.form-page-wrap { max-width: 700px; margin: 0 auto; }
.form-card {
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.form-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--color-text); }
.form-main { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.visible { display: block; }
  .sidebar-toggle-btn { display: flex; }
  .menu-toggle { display: flex; }
  .app-body { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}

/* ─── Utilidades ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-1 { margin-top: 1rem; }
.text-center { text-align: center; }
.unit { font-size: 0.7em; font-weight: 400; opacity: .7; }
.input-btn-row { display: flex; gap: 0.5rem; }
.input-btn-row .form-input { flex: 1; }
.back-btn { margin-bottom: 1rem; }
.row-inactive { opacity: 0.55; }
