/* ============================================================
   costeo.basti.pe — Estilos principales
   ============================================================ */

:root {
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --portal-bar-height: 28px;
  --color-primary:   #C0392B;
  --color-secondary: #2C3E50;
  --color-bg:        #F4F6F9;
  --color-sidebar:   #1a2332;
  --color-sidebar-text: #b0bec5;
  --color-sidebar-active: #ffffff;
  --color-portal-bar: #1a1209;
  --color-gold: #C89B3C;
  --semaforo-verde:     #27AE60;
  --semaforo-amarillo:  #F39C12;
  --semaforo-rojo:      #E74C3C;
}

/* ── Reset / Base ── */
* { box-sizing: border-box; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--color-bg);
  display: flex;
  min-height: 100vh;
  margin: 0;
}

/* ── Portal bar (full-width, fixed, above sidebar and content) ── */
#portal-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--portal-bar-height);
  background: var(--color-portal-bar);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 12px;
}
#portal-bar a {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: rgba(255,255,255,.75);
  font-weight: 500;
  letter-spacing: .3px;
}
#portal-bar a:hover { color: #fff; }
#portal-bar .b-badge {
  background: var(--color-gold);
  color: #1a1209;
  font-weight: 800;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}
#portal-bar .sep   { color: rgba(255,255,255,.25); }
#portal-bar .crumb { color: rgba(255,255,255,.45); }

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  position: fixed;
  top: var(--portal-bar-height);
  left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
  overflow-y: auto;
}

/* Brand area blends seamlessly with the portal bar */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 1.1rem;
  color: #fff;
  background: var(--color-portal-bar);
  border-bottom: 1px solid rgba(200,155,60,.15);
}
.brand-icon { font-size: 1.4rem; }
.brand-name strong { color: var(--color-gold); }

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
}
.sidebar-nav .nav-section {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #546e7a;
  padding: 14px 20px 4px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--color-sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,.07);
  color: var(--color-sidebar-active);
}
.sidebar-nav a.active {
  border-left: 3px solid var(--color-gold);
  color: #fff;
}
.sidebar-nav a i { width: 18px; text-align: center; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem;
  flex-shrink: 0;
}
.user-name  { font-size: .8rem; color: #fff; font-weight: 600; }
.user-role  { font-size: .7rem; color: var(--color-sidebar-text); }

/* ── Main content ── */
#main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--portal-bar-height);
  flex: 1;
  min-height: calc(100vh - var(--portal-bar-height));
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-secondary);
  margin: 0;
  flex-grow: 1;
}
.topbar-right { margin-left: auto; }

/* ── Cards KPI ── */
.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  gap: 16px;
  border-left: 4px solid var(--color-primary);
}
.kpi-icon {
  font-size: 2rem;
  color: var(--color-primary);
  opacity: .85;
}
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--color-secondary); }
.kpi-label { font-size: .75rem; color: #78909c; text-transform: uppercase; letter-spacing: .05em; }

/* ── Semáforo ── */
.semaforo-verde    { color: var(--semaforo-verde) !important; font-weight: 700; }
.semaforo-amarillo { color: var(--semaforo-amarillo) !important; font-weight: 700; }
.semaforo-rojo     { color: var(--semaforo-rojo) !important; font-weight: 700; }

.badge-verde    { background: var(--semaforo-verde) !important; }
.badge-amarillo { background: var(--semaforo-amarillo) !important; }
.badge-rojo     { background: var(--semaforo-rojo) !important; }

/* ── Tablas ── */
.table-costeo thead th {
  background: var(--color-secondary);
  color: #fff;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: none;
}
.table-costeo tbody tr:hover { background: #f8f9fa; }

/* ── Página de login ── */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 3rem; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--color-secondary); margin: 4px 0 0; }
.login-logo span { color: var(--color-primary); }

/* ── Upload drop zone ── */
.drop-zone {
  border: 2.5px dashed #b0bec5;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafbfc;
}
.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--color-primary);
  background: #fff5f5;
}
.drop-zone i { font-size: 3rem; color: #b0bec5; margin-bottom: 12px; }
.drop-zone.dragover i { color: var(--color-primary); }

/* ── Porcentaje diferencia ── */
.diff-up   { color: var(--semaforo-rojo); }
.diff-down { color: var(--semaforo-verde); }
.diff-zero { color: #78909c; }

/* ── Responsive ── */
@media (max-width: 991px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.show { transform: translateX(0); }
  #main-content { margin-left: 0; }
}

/* ── Topbar sticky stays below portal bar ── */
.topbar { top: 0; }

/* ── Misc ── */
.page-section {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 24px;
}
.section-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #546e7a;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-bg);
}
