/* =====================================================================
   WorkLink — Tema oscuro, vívido y animado
   ===================================================================== */

:root {
  --bg: #0b0a14;
  --bg-elevated: #131226;
  --bg-card: #171630;
  --bg-card-hover: #1d1c3d;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);

  --text: #f4f3ff;
  --text-dim: #a9a6c9;
  --text-mute: #726f95;

  --violet: #8b5cf6;
  --magenta: #ec4899;
  --cyan: #22d3ee;
  --orange: #fb923c;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;

  --grad-primary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 55%, #fb923c 100%);
  --grad-cool: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 100%);
  --grad-hero: linear-gradient(120deg, #7c3aed 0%, #db2777 45%, #f97316 100%);
  --grad-success: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);

  --shadow-glow: 0 10px 40px -10px rgba(139, 92, 246, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: 'Poppins', 'Inter', sans-serif;
  line-height: 1.25;
  margin: 0 0 .5em;
}

a { color: inherit; text-decoration: none; }
p { color: var(--text-dim); }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Fondo con glow animado ---------- */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .35;
  z-index: -1;
  pointer-events: none;
  animation: floatGlow 18s ease-in-out infinite alternate;
}
.bg-glow-1 {
  width: 520px; height: 520px;
  background: var(--violet);
  top: -150px; left: -100px;
}
.bg-glow-2 {
  width: 480px; height: 480px;
  background: var(--magenta);
  bottom: -180px; right: -120px;
  animation-delay: 4s;
}
@keyframes floatGlow {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(40px,-30px) scale(1.1); }
  100% { transform: translate(-30px,20px) scale(0.95); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(11, 10, 20, 0.75);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-primary); color: #fff; font-size: 1.05rem;
  box-shadow: var(--shadow-glow);
}
.logo-text {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { color: var(--text-dim); font-weight: 500; font-size: .95rem; transition: color .2s; }
.main-nav a:hover { color: var(--text); }
.nav-admin {
  color: var(--yellow) !important;
  border: 1px solid rgba(251,191,36,.4); border-radius: 20px; padding: 6px 14px;
}
.nav-icon-link { font-size: 1.05rem; }
.nav-toggle {
  display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer;
}

.nav-user-menu { position: relative; }
.nav-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 30px; cursor: pointer; font-size: .9rem;
  transition: border-color .2s;
}
.nav-user-btn:hover { border-color: var(--border-light); }
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; background: var(--grad-cool);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: #fff;
}
.nav-user-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-width: 190px; padding: 8px; display: none; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.nav-user-dropdown.open { display: flex; }
.nav-user-dropdown a { padding: 9px 12px; border-radius: 8px; font-size: .9rem; color: var(--text-dim); display: flex; gap: 8px; align-items: center;}
.nav-user-dropdown a:hover { background: var(--bg-card-hover); color: var(--text); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn:active { transform: scale(.97); }
.btn-gradient { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-glow); }
.btn-gradient:hover { box-shadow: 0 14px 46px -8px rgba(236,72,153,.55); transform: translateY(-2px); }
.btn-outline { background: transparent; border-color: var(--border-light); color: var(--text); }
.btn-outline:hover { border-color: var(--violet); color: var(--violet); }
.btn-success { background: var(--grad-success); color: #06261e; }
.btn-danger { background: linear-gradient(135deg,#f87171,#ef4444); color: #2b0707; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 60px; text-align: center; position: relative;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; margin-bottom: 18px;
}
.hero .grad-text {
  background: var(--grad-hero); -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% auto; animation: gradShift 6s linear infinite;
}
@keyframes gradShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.hero p.lead { font-size: 1.15rem; max-width: 640px; margin: 0 auto 34px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 46px; }
.hero-search {
  max-width: 620px; margin: 0 auto; display: flex; gap: 10px; background: var(--bg-card);
  border: 1px solid var(--border); padding: 8px; border-radius: 16px;
}
.hero-search input {
  flex: 1; background: transparent; border: none; color: var(--text); padding: 10px 14px; font-size: 1rem;
}
.hero-search input:focus { outline: none; }

.hero-stats { display: flex; justify-content: center; gap: 50px; margin-top: 50px; flex-wrap: wrap; }
.hero-stat strong { display: block; font-size: 1.8rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent;}
.hero-stat span { color: var(--text-mute); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Secciones / cards ---------- */
.section { padding: 50px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px;}
.section-head h2 { font-size: 1.7rem; }
.section-head p { margin: 0; }

.grid { display: grid; gap: 22px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-light); box-shadow: 0 20px 45px -20px rgba(139,92,246,.4); }

.category-card { text-align: center; cursor: pointer; }
.category-card .icon {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff;
  background: var(--grad-cool);
}
.category-card:nth-child(2n) .icon { background: var(--grad-primary); }
.category-card:nth-child(3n) .icon { background: var(--grad-success); color: #06261e; }

.project-card { display: flex; flex-direction: column; gap: 12px; }
.project-card .top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-card h3 { font-size: 1.15rem; }
.project-card .desc { font-size: .92rem; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: .82rem; color: var(--text-mute); }
.project-card .meta span { display: flex; align-items: center; gap: 6px; }
.project-card .budget { font-weight: 700; font-size: 1.1rem; background: var(--grad-success); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: rgba(139,92,246,.14); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3);
  padding: 4px 10px; border-radius: 20px; font-size: .78rem; font-weight: 500;
}

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; }
.badge-info { background: rgba(34,211,238,.15); color: var(--cyan); border: 1px solid rgba(34,211,238,.35); }
.badge-success { background: rgba(52,211,153,.15); color: var(--green); border: 1px solid rgba(52,211,153,.35); }
.badge-warning { background: rgba(251,191,36,.15); color: var(--yellow); border: 1px solid rgba(251,191,36,.35); }
.badge-danger { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.35); }
.badge-muted { background: rgba(255,255,255,.08); color: var(--text-mute); border: 1px solid var(--border); }

/* ---------- Formularios ---------- */
.form-card { max-width: 560px; margin: 40px auto; }
.form-group { margin-bottom: 18px; }
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 7px; color: var(--text-dim); }
input, textarea, select {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font-size: .95rem; font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.25);
}
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }
.role-select { display: flex; gap: 14px; }
.role-option {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center;
  cursor: pointer; transition: all .2s;
}
.role-option:hover { border-color: var(--border-light); }
.role-option input { display: none; }
.role-option.selected { border-color: var(--violet); background: rgba(139,92,246,.1); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
.role-option i { font-size: 1.6rem; margin-bottom: 8px; display: block; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Alertas ---------- */
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.alert-success { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.35); color: #6ee7b7; }
.alert-error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.35); color: #fca5a5; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.auth-card {
  width: 100%; max-width: 460px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
}
.auth-card h1 { font-size: 1.6rem; text-align: center; }
.auth-card > p.sub { text-align: center; margin-bottom: 26px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--text-dim); }

/* ---------- Dashboard ---------- */
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-card .icon-box {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; background: var(--grad-primary); flex-shrink: 0;
}
.stat-card .value { font-size: 1.5rem; font-weight: 800; }
.stat-card .label { font-size: .82rem; color: var(--text-mute); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tabs a { padding: 12px 18px; font-weight: 600; font-size: .92rem; color: var(--text-mute); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--magenta); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--text-mute); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; }
tr:hover td { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- Chat ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; height: 70vh; min-height: 500px; }
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; height: auto; } }
.conv-list { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .2s; }
.conv-item:hover, .conv-item.active { background: var(--bg-card-hover); }
.conv-item .name { font-weight: 600; font-size: .92rem; }
.conv-item .last { font-size: .8rem; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { max-width: 65%; padding: 10px 15px; border-radius: 16px; font-size: .9rem; }
.msg-bubble.mine { align-self: flex-end; background: var(--grad-primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--bg-elevated); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-time { font-size: .68rem; opacity: .7; margin-top: 4px; display: block; }
.chat-input-row { display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; }

/* ---------- Perfil ---------- */
.profile-header { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.avatar-lg {
  width: 96px; height: 96px; border-radius: 50%; background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 800; color: #fff;
  box-shadow: var(--shadow-glow);
}
.stars { color: var(--yellow); letter-spacing: 2px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding-top: 50px; }
.footer-inner { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 30px; }
.footer-brand { max-width: 320px; }
.footer-brand p { margin-top: 10px; font-size: .88rem; }
.footer-cols { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-cols h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); margin-bottom: 14px; }
.footer-cols a { display: block; color: var(--text-dim); font-size: .9rem; margin-bottom: 10px; }
.footer-cols a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding: 20px 0; text-align: center; color: var(--text-mute); font-size: .82rem; }

/* ---------- Utilidades ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-mute); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 16px; } .mb-2 { margin-bottom: 16px; }
.mt-4 { margin-top: 32px; } .mb-4 { margin-bottom: 32px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-mute); }
.empty-state i { font-size: 2.6rem; margin-bottom: 14px; opacity: .5; }

/* ---------- Responsive nav ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .main-nav {
    /* "top" coincide con la altura real del header (que ahora depende
       del alto del logo personalizado, ver .logo-img más abajo). */
    position: fixed; top: 107px; left: 0; right: 0; bottom: 0;
    background: var(--bg-elevated); flex-direction: column; align-items: flex-start;
    padding: 24px; gap: 18px; transform: translateX(-100%); transition: transform .3s ease;
    overflow-y: auto;
  }
  .main-nav.open { transform: translateX(0); }
}
@media (max-width: 640px) {
  .main-nav { top: 91px; }
}
@media (max-width: 480px) {
  .main-nav { top: 81px; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.4); border-radius: 8px; }

/* ---------- Logo personalizado (Admin → Configuración) ----------
   Se muestra a su ancho natural (no recortado en un cuadrado de ícono):
   la altura queda fija para que respete la barra de navegación, y el
   ancho se ajusta solo según la proporción real de la imagen subida.
   Muchos logos tipo "wordmark" son bien anchos (proporción ~3:1), por
   lo que le damos bastante más aire: altura generosa (74px) y un ancho
   máximo amplio para que se luzca sin recortarse ni verse chico. */
.header-inner { min-height: 74px; }
.logo-img {
  height: 74px;
  width: auto;
  max-width: 340px;
  object-fit: contain;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .logo-img { height: 58px; max-width: 260px; }
}
@media (max-width: 480px) {
  .logo-img { height: 48px; max-width: 200px; }
}
