/* ============================================================
   Panel de gestión — Rigel Digital Solutions
   Mismo lenguaje visual que la web (dark + neon/tech)
   ============================================================ */

:root {
  --bg:        #050510;
  --surface:   #0d0d1a;
  --surface2:  #13131f;
  --surface3:  #191927;
  --border:    rgba(255,255,255,0.08);
  --border-2:  rgba(255,255,255,0.14);
  --cyan:      #00d4ff;
  --violet:    #6C3FF5;
  --pink:      #FF3DFF;
  --gradient:  linear-gradient(135deg, #00d4ff 0%, #6C3FF5 100%);
  --gradient2: linear-gradient(135deg, #6C3FF5 0%, #FF3DFF 100%);
  --text:      #ffffff;
  --muted:     #a0a0b0;
  --dim:       #5a5a7a;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow:    0 4px 24px rgba(0, 212, 255, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --ok-bg: rgba(0, 212, 130, 0.12);   --ok-text: #4de3a8;
  --warn-bg: rgba(255, 184, 0, 0.14); --warn-text: #ffc94d;
  --danger-bg: rgba(255, 61, 61, 0.14); --danger-text: #ff7a7a;
  --info-bg: rgba(108, 63, 245, 0.16); --info-text: #b39dff;
  --review-bg: rgba(255, 61, 255, 0.12); --review-text: #ff8cff;
  --done-bg:   rgba(0, 212, 130, 0.12); --done-text:   #4de3a8;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(108, 63, 245, 0.18), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(0, 212, 255, 0.12), transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }

/* ── Layout ────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  color: #fff;
  padding: 22px 14px;
  flex-shrink: 0;
}
.sidebar h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 4px 8px 26px;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: var(--transition);
}
.sidebar a:hover { background: var(--surface2); color: #fff; }
.sidebar a.active {
  background: var(--info-bg);
  color: #fff;
  border-color: rgba(108, 63, 245, 0.35);
}
.sidebar a[href="logout.php"] {
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  border-radius: 0;
  color: var(--dim);
}
.sidebar a[href="logout.php"]:hover { color: var(--muted); background: none; }

.main { flex: 1; padding: 32px 36px; max-width: 1280px; }

h1 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.subtitle { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}
.card h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  color: #fff;
}

/* ── Stat tiles (Resumen) ──────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-2); transform: translateY(-1px); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  margin-top: 8px;
  color: #fff;
}
.stat-value.accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-value.alert { color: var(--warn-text); }

/* ── Logos ─────────────────────────────────────────────────── */
.logo-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.logo-thumb.placeholder { background: var(--surface3); color: var(--dim); font-size: 11px; }
.logo-thumb--sm { width: 36px; height: 36px; }
.logo-thumb--lg { width: 56px; height: 56px; }

/* ── Buscador ──────────────────────────────────────────────── */
.search-box { margin-bottom: 14px; }
.search-box input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 360px;
  padding: 9px 14px;
  background: var(--surface2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #fff;
}
.search-box input::placeholder { color: var(--dim); }
.search-box input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}
.search-box input::-webkit-search-cancel-button { display: none; }

/* ── Tabla ─────────────────────────────────────────────────── */
.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  margin-bottom: 0;
}
table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.table-scroll table { box-shadow: none; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  white-space: nowrap;
}
td.wrap { white-space: normal; }
th {
  background: var(--surface3);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }
td a { color: var(--cyan); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

/* ── Botones ───────────────────────────────────────────────── */
.btn {
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  display: inline-block;
  transition: var(--transition);
  box-shadow: 0 2px 14px rgba(0, 212, 255, 0.18);
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface3);
  color: var(--muted);
  border: 1px solid var(--border-2);
  box-shadow: none;
}
.btn-secondary:hover { color: #fff; border-color: var(--cyan); filter: none; }
.btn-danger {
  background: rgba(255, 61, 61, 0.14);
  color: var(--danger-text);
  border: 1px solid rgba(255, 61, 61, 0.3);
  box-shadow: none;
}
.btn-danger:hover { background: rgba(255, 61, 61, 0.22); filter: none; }

.toolbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }

/* ── Formularios ───────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label {
  display: block;
  font-size: 12.5px;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 500;
}
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #fff;
  transition: var(--transition);
}
.form-grid input::placeholder, .form-grid textarea::placeholder { color: var(--dim); }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}
.form-grid select option { background: var(--surface2); color: #fff; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-select {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  appearance: none;
  -webkit-appearance: none;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-select option { background: var(--surface2); color: #fff; }
.badge-pendiente { background: var(--warn-bg); color: var(--warn-text); }
.badge-pagada, .badge-activa, .badge-produccion { background: var(--ok-bg); color: var(--ok-text); }
.badge-vencida { background: var(--danger-bg); color: var(--danger-text); }
.badge-en_curso, .badge-en_desarrollo { background: var(--info-bg); color: var(--info-text); }
.badge-pausada, .badge-pausado { background: rgba(255,255,255,0.06); color: var(--dim); }

/* ── Kanban ────────────────────────────────────────────────── */
.kanban { display: flex; gap: 16px; align-items: flex-start; }
.kanban-col {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 300px;
}
.kanban-col.col-pendiente  { background: var(--warn-bg); border-color: rgba(255,184,0,0.25); }
.kanban-col.col-en_curso   { background: var(--info-bg); border-color: rgba(108,63,245,0.25); }
.kanban-col.col-revision   { background: var(--review-bg); border-color: rgba(255,61,255,0.25); }
.kanban-col.col-entregado  { background: var(--done-bg); border-color: rgba(0,212,130,0.25); }
.kanban-col h3 {
  font-family: var(--font-head);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 12px;
}
.kanban-card {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.kanban-card strong { color: #fff; }

.checklist { list-style: none; margin: 8px 0 4px; padding: 0; }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 0; }
.checklist li label { display: flex; align-items: center; gap: 6px; cursor: pointer; flex: 1; font-size: 12px; }
.checklist li input[type="checkbox"] { width: auto; accent-color: var(--cyan); cursor: pointer; }
.checklist .done { text-decoration: line-through; color: var(--dim); }
.checklist-del {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 4px;
}
.checklist-del:hover { color: var(--danger-text); }
.checklist-progress { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.checklist-add input {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
}
.checklist-add input::placeholder { color: var(--dim); }
.checklist-add input:focus { outline: none; border-color: var(--cyan); border-style: solid; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(108, 63, 245, 0.25), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(0, 212, 255, 0.18), transparent 45%);
}
.login-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  width: 340px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.login-box h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 19px;
  margin: 0 0 22px;
  text-align: center;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-box input {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}
.login-box input::placeholder { color: var(--dim); }
.login-box input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15); }

.error { color: var(--danger-text); font-size: 13px; margin-bottom: 12px; text-align: center; }

.alert-box {
  background: var(--warn-bg);
  border: 1px solid rgba(255, 184, 0, 0.3);
  color: var(--warn-text);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 13.5px;
}
.alert-ok { background: var(--ok-bg); border-color: rgba(0, 212, 130, 0.3); color: var(--ok-text); }

form.inline { display: inline; }

/* ── Tablet ────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Celular: sidebar pasa a ser una barra superior con scroll horizontal ── */
@media (max-width: 700px) {
  .layout { flex-direction: column; min-height: auto; }

  .sidebar {
    width: 100%;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar h2 { margin: 0 10px 0 2px; flex-shrink: 0; font-size: 15px; }
  .sidebar a {
    flex-shrink: 0;
    padding: 8px 12px;
    margin-bottom: 0;
    font-size: 13px;
  }
  .sidebar a[href="logout.php"] {
    margin-top: 0;
    margin-left: auto;
    border-top: none;
    padding-top: 8px;
    flex-shrink: 0;
  }

  .main { padding: 16px; }

  h1 { font-size: 20px; }
  .toolbar { flex-wrap: wrap; gap: 10px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 24px; }

  .card { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  .kanban { flex-direction: column; }
  .kanban-col { min-height: auto; }

  th, td { padding: 10px; font-size: 13px; }

  .btn, .btn-secondary, .btn-danger { padding: 9px 14px; font-size: 13px; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
}
