/* =====================================================================
 * PIXELLOW · app.css
 * Estilos completos del sistema de gestión
 * ===================================================================== */

:root {
  --bg: #0a0a0b;
  --bg-elev: #131416;
  --bg-card: #1a1c1f;
  --border: #2a2e33;
  --border-soft: #1f2227;
  --text: #ececec;
  --text-dim: #888d93;
  --text-faint: #585d63;

  /* PIXELLOW brand */
  --pix-red:   #c81414;
  --pix-green: #008c3c;
  --pix-blue:  #0078b4;
  --pix-gray:  #8c8c8c;

  /* Accent default = azul PIXELLOW (sobreescribible inline desde PHP) */
  --accent: #0078b4;
  --accent-dim: #005a8c;
  --accent-glow: rgba(0, 120, 180, 0.15);

  --warn: #ffb547;
  --danger: #ff5d5d;
  --ok: #4ade80;
  --info: #6fb8ff;
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter Tight', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(0,140,60,0.04), transparent 60%),
    radial-gradient(ellipse 40% 30% at 0% 80%, rgba(200,20,20,0.03), transparent 60%);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ===================================================================
 * LOGIN
 * =================================================================== */
.login-body { background: #000; }
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 1;
  transition: opacity 1s ease-out, filter 1s ease-out;
}
.login-video.faded { opacity: 0.25; filter: blur(2px); }

.login-card {
  position: relative; z-index: 10;
  width: 100%; max-width: 380px;
  padding: 38px 32px;
  background: rgba(15, 16, 18, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,120,180,0.1);
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.login-card.visible { opacity: 1; transform: translateY(0); }

.login-logo {
  width: 200px; max-width: 100%; height: auto;
  margin: 0 auto 8px auto;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6));
}
.login-subtitle {
  text-align: center;
  font-size: 11px; letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 500;
  margin-bottom: 28px;
}
.login-title {
  text-align: center;
  font-size: 13px; color: var(--text-dim);
  margin-bottom: 22px; font-weight: 500;
}
.login-error {
  background: rgba(255,93,93,0.1);
  border: 1px solid rgba(255,93,93,0.3);
  color: #ff8e8e;
  padding: 9px 12px; border-radius: 3px;
  font-size: 12.5px; margin-bottom: 14px;
}
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); font-weight: 600; margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 11px 13px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  color: var(--text); font-family: inherit; font-size: 14px;
  transition: all 0.15s;
}
.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-btn {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 3px;
  font-family: inherit; font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
  cursor: pointer; margin-top: 6px;
  transition: all 0.15s;
}
.login-btn:hover {
  background: var(--accent-dim);
  box-shadow: 0 8px 22px var(--accent-glow);
  transform: translateY(-1px);
}
.login-footer {
  text-align: center; margin-top: 22px;
  font-size: 11px; color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}
.login-rgb-bar {
  display: flex; height: 3px; margin: 24px -32px 0 -32px;
  border-radius: 0 0 8px 8px; overflow: hidden;
}
.login-rgb-bar span { flex: 1; }
.login-rgb-bar .r { background: var(--pix-red); }
.login-rgb-bar .g { background: var(--pix-green); }
.login-rgb-bar .b { background: var(--pix-blue); }

.login-skip {
  position: absolute; top: 20px; right: 20px; z-index: 11;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-dim); padding: 6px 12px;
  font-size: 11px; font-family: inherit; cursor: pointer;
  border-radius: 100px; transition: all 0.15s;
}
.login-skip:hover { color: var(--text); background: rgba(255,255,255,0.1); }

/* ===================================================================
 * APP SHELL
 * =================================================================== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border-soft);
  padding: 20px 16px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.logo-block {
  padding: 4px 4px 18px 4px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}
.logo-block img { height: 40px; width: auto; }
.logo-block .tag {
  display: block;
  font-size: 9px; color: var(--text-faint); letter-spacing: 0.2em; text-transform: uppercase;
  margin-top: 8px; font-weight: 600;
}
.logo-block .tag .dot-r { color: var(--pix-red); }
.logo-block .tag .dot-g { color: var(--pix-green); }
.logo-block .tag .dot-b { color: var(--pix-blue); }

.nav-section { margin-bottom: 20px; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-faint); padding: 0 8px 8px 8px;
  font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 3px;
  color: var(--text-dim); cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  transition: all 0.12s;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-card); color: var(--text); }
.nav-item.active { background: var(--bg-card); color: var(--text); }
.nav-item.active::before {
  content: ''; width: 3px; height: 14px;
  background: var(--accent); margin-left: -10px; margin-right: 7px;
  border-radius: 2px;
}
.nav-icon { width: 16px; display: inline-flex; justify-content: center; opacity: 0.8; }

.sidebar-footer {
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pix-red), var(--pix-green), var(--pix-blue));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; text-transform: uppercase;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-rol { font-size: 11px; color: var(--text-faint); }
.logout-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: 5px 8px;
  border-radius: 3px; cursor: pointer; font-size: 13px;
  text-decoration: none; transition: all 0.12s;
}
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }

/* ===================================================================
 * MAIN + TOPBAR
 * =================================================================== */
.main { overflow-x: hidden; }
.topbar {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(10,10,11,0.7);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 50;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); flex: 1; }
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-faint); }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.mobile-toggle {
  display: none;
  background: transparent; border: 0; color: var(--text);
  font-size: 20px; cursor: pointer; padding: 0; width: 28px;
}

/* ===================================================================
 * BUTTONS
 * =================================================================== */
.btn {
  padding: 7px 12px; border-radius: 3px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s; text-decoration: none;
}
.btn:hover { border-color: var(--text-faint); background: var(--bg-elev); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--bg-card); }
.btn-sm { padding: 4px 8px; font-size: 11.5px; }
.btn-danger { color: var(--danger); border-color: rgba(255,93,93,0.3); }
.btn-danger:hover { background: rgba(255,93,93,0.1); border-color: var(--danger); }

/* ===================================================================
 * PAGE LAYOUT
 * =================================================================== */
.page { padding: 28px; max-width: 1400px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; gap: 20px; flex-wrap: wrap; }
.page-title {
  font-size: 32px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.05;
}
.page-title .accent {
  font-family: 'Instrument Serif', serif; font-style: italic; font-weight: 400;
  color: var(--accent); letter-spacing: -0.01em;
}
.page-sub { color: var(--text-dim); font-size: 14px; margin-top: 6px; max-width: 540px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text); }
.section-title small { color: var(--text-faint); font-weight: 500; margin-left: 8px; letter-spacing: 0; text-transform: none; }

/* ===================================================================
 * KPIs
 * =================================================================== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px; }
.kpi {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.6;
}
.kpi:nth-child(1)::after { background: linear-gradient(90deg, var(--pix-red), transparent); }
.kpi:nth-child(2)::after { background: linear-gradient(90deg, var(--pix-green), transparent); }
.kpi:nth-child(3)::after { background: linear-gradient(90deg, var(--pix-blue), transparent); }
.kpi:nth-child(4)::after { background: linear-gradient(90deg, var(--pix-gray), transparent); }
.kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); font-weight: 600; }
.kpi-value { font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; }
.kpi-delta { font-size: 11.5px; color: var(--ok); margin-top: 4px; font-weight: 500; }
.kpi-delta.neg { color: var(--danger); }

/* ===================================================================
 * PROJECT CARDS
 * =================================================================== */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.proj-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: all 0.15s; position: relative;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden; text-decoration: none; color: inherit;
}
.proj-card::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0; transition: opacity 0.15s;
}
.proj-card:hover { border-color: var(--text-faint); transform: translateY(-1px); }
.proj-card:hover::before { opacity: 1; }
.proj-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.proj-name { font-weight: 700; font-size: 17px; letter-spacing: -0.015em; }
.proj-loc { font-size: 11.5px; color: var(--text-dim); margin-top: 3px; }

.proj-card-new {
  border-style: dashed;
  align-items: center; justify-content: center;
  min-height: 230px;
}
.new-card-content { text-align: center; color: var(--text-faint); }
.new-card-plus { font-size: 28px; color: var(--accent); font-weight: 300; }
.new-card-text { font-size: 13px; margin-top: 6px; font-weight: 500; }

/* BADGES */
.badge {
  font-size: 10px; padding: 3px 7px; border-radius: 100px;
  font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid; white-space: nowrap;
}
.badge.active { background: rgba(0,140,60,0.12); color: #4ade80; border-color: rgba(0,140,60,0.4); }
.badge.warn { background: rgba(255,181,71,0.1); color: var(--warn); border-color: rgba(255,181,71,0.3); }
.badge.draft { background: rgba(138,143,150,0.1); color: var(--text-dim); border-color: rgba(138,143,150,0.25); }

.proj-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; font-size: 11.5px; }
.proj-meta-item .lbl { color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9.5px; font-weight: 600; }
.proj-meta-item .val { font-family: 'JetBrains Mono', monospace; color: var(--text); font-size: 12.5px; margin-top: 2px; font-weight: 500; }

.progress-label { font-size: 10px; color: var(--text-faint); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress { flex: 1; height: 4px; background: var(--bg); border-radius: 100px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.3s; }
.progress-fill.danger { background: var(--danger); }
.progress-fill.warn { background: var(--warn); }
.progress-pct { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-dim); min-width: 36px; text-align: right; }

/* ===================================================================
 * FLASH MESSAGES
 * =================================================================== */
.flash-container { padding: 14px 28px 0 28px; }
.flash {
  padding: 10px 16px; border-radius: 4px;
  font-size: 13px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid;
  animation: flashIn 0.25s ease-out;
}
.flash-close {
  margin-left: auto; background: transparent; border: 0;
  color: inherit; font-size: 18px; cursor: pointer; opacity: 0.6; line-height: 1;
}
.flash-close:hover { opacity: 1; }
.flash-info { background: rgba(111,184,255,0.08); border-color: rgba(111,184,255,0.3); color: var(--info); }
.flash-ok   { background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.3); color: var(--ok); }
.flash-warn { background: rgba(255,181,71,0.08); border-color: rgba(255,181,71,0.3); color: var(--warn); }
.flash-error{ background: rgba(255,93,93,0.08); border-color: rgba(255,93,93,0.3); color: var(--danger); }

@keyframes flashIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ===================================================================
 * EMPTY STATE
 * =================================================================== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
  background: var(--bg-card); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }

/* ===================================================================
 * HELPERS
 * =================================================================== */
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ===================================================================
 * RESPONSIVE
 * =================================================================== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -260px; top: 0;
    width: 240px; height: 100vh; z-index: 200;
    transition: left 0.2s;
  }
  .sidebar.open { left: 0; box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
  .mobile-toggle { display: inline-flex; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 18px; }
  .topbar { padding: 14px 18px; }
  .login-card { max-width: calc(100% - 32px); padding: 28px 22px; }
  .login-logo { width: 160px; }
  .page-title { font-size: 26px; }
}

@media (max-width: 500px) {
  .kpi-row { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
}
