/*
 * app.css — Phytoplant NIR Platform
 * Tema claro forzado. Verde Phytoplant. Textos grandes y legibles.
 */

/* ─────────────────────────────────────────────
   VARIABLES Y ESQUEMA DE COLOR — bloque único
   ───────────────────────────────────────────── */
:root {
  --bg:        #f2f5f2;
  --surface:   #ffffff;
  --panel:     #edf2ee;
  --panel2:    #e0e9e1;
  --border:    #c4d4c6;
  --accent:    #2e7d4f;
  --accent-h:  #1f5c38;
  --accent-lt: #e4f2e9;
  --muted:     #6b9278;
  --text:      #162119;
  --text2:     #3d5e45;
  --danger:    #b03a2e;
  --danger-lt: #fcecea;
  --success:   #1e6e3e;
  --radius:    8px;
  --sidebar-w: 240px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.09);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.14);
}

/* ─────────────────────────────────────────────
   RESET
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: #f2f5f2 !important;
  color: #162119 !important;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────
   LOGIN
   ───────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e8f0ea !important;
  background-image: linear-gradient(140deg, #deeee3 0%, #f0f5f1 50%, #e4ede6 100%);
}

.login-box {
  width: 420px;
  background-color: #ffffff !important;
  border: 1px solid #c4d4c6;
  border-radius: 16px;
  padding: 52px 48px 48px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .35s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-logo   { text-align: center; margin-bottom: 40px; }
.l-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: #6b9278; display: block; margin-bottom: 12px;
}
.l-brand {
  font-family: 'Space Mono', monospace;
  font-size: 28px; font-weight: 700;
  color: #162119; letter-spacing: -1px;
}
.l-brand span { color: #2e7d4f; }
.l-dot {
  width: 8px; height: 8px;
  background: #2e7d4f; border-radius: 50%;
  margin: 16px auto 0;
  animation: pulse 2.5s infinite;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.35; transform:scale(1.6); }
}

.f-label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #3d5e45; margin-bottom: 8px;
}
.f-input {
  width: 100%;
  background-color: #edf2ee !important;
  border: 1.5px solid #c4d4c6;
  border-radius: var(--radius);
  color: #162119 !important;
  font-family: 'Outfit', sans-serif; font-size: 16px;
  padding: 12px 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 20px;
}
.f-input:focus {
  border-color: #2e7d4f;
  box-shadow: 0 0 0 3px rgba(46,125,79,.15);
  background-color: #ffffff !important;
}

/* ─────────────────────────────────────────────
   BOTONES
   ───────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 14px;
  background-color: #2e7d4f !important; color: #ffffff !important;
  border: none; border-radius: var(--radius);
  font-family: 'Space Mono', monospace; font-weight: 700;
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  cursor: pointer; transition: all .15s; margin-top: 4px;
  box-shadow: 0 3px 10px rgba(46,125,79,.3);
}
.btn-primary:hover {
  background-color: #1f5c38 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(46,125,79,.35);
}

.btn-save {
  padding: 10px 24px;
  background-color: #2e7d4f !important; color: #ffffff !important;
  border: none; border-radius: var(--radius);
  font-family: 'Space Mono', monospace; font-weight: 700;
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 2px 8px rgba(46,125,79,.25);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-save:hover {
  background-color: #1f5c38 !important;
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────
   ALERTAS
   ───────────────────────────────────────────── */
.alert {
  padding: 13px 18px; border-radius: var(--radius);
  font-size: 15px; margin-bottom: 20px;
}
.alert-err { background-color: #fcecea !important; border: 1px solid rgba(176,58,46,.3); color: #b03a2e !important; }
.alert-ok  { background-color: #e4f2e9 !important; border: 1px solid rgba(46,125,79,.3); color: #1e6e3e !important; }

/* ─────────────────────────────────────────────
   APP LAYOUT
   ───────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

/* ─────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background-color: #ffffff !important;
  border-right: 1px solid #c4d4c6;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
  box-shadow: var(--shadow-sm);
}
.sb-header {
  padding: 24px 22px 20px;
  background-color: #2e7d4f !important;
  border-bottom: none;
}
.sb-eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 9px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(255,255,255,.7); display: block; margin-bottom: 5px;
}
.sb-brand {
  font-family: 'Space Mono', monospace;
  font-size: 18px; font-weight: 700; color: #ffffff; letter-spacing: -.5px;
}
.sb-brand span { color: rgba(255,255,255,.55); }

.sb-user {
  padding: 16px 18px; border-bottom: 1px solid #c4d4c6;
  display: flex; align-items: center; gap: 12px;
  background-color: #edf2ee !important;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background-color: #2e7d4f !important;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Mono', monospace; font-size: 16px; font-weight: 700; color: #fff;
  box-shadow: 0 2px 6px rgba(46,125,79,.3);
}
.u-name { font-size: 15px; font-weight: 600; color: #162119; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: 11px; color: #6b9278; font-family: 'Space Mono', monospace; margin-top: 2px; }

.sb-nav { flex: 1; padding: 14px 10px; overflow-y: auto; background-color: #ffffff !important; }
.nav-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  color: #6b9278; padding: 12px 12px 6px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius);
  color: #3d5e45 !important; text-decoration: none; font-size: 15px;
  transition: all .15s; margin-bottom: 3px;
  border: 1px solid transparent;
}
.nav-item:hover  { background-color: #e4f2e9 !important; color: #2e7d4f !important; border-color: rgba(46,125,79,.2); }
.nav-item.active { background-color: #e4f2e9 !important; color: #2e7d4f !important; border-color: rgba(46,125,79,.3); font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sb-footer { padding: 10px; border-top: 1px solid #c4d4c6; background-color: #ffffff !important; }
.btn-logout {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 14px; border-radius: var(--radius);
  background: none; border: 1px solid transparent;
  color: #3d5e45 !important; font-family: 'Outfit', sans-serif; font-size: 15px;
  cursor: pointer; transition: all .15s; text-align: left;
}
.btn-logout:hover { background-color: #fcecea !important; color: #b03a2e !important; border-color: rgba(176,58,46,.2); }

/* ─────────────────────────────────────────────
   MAIN
   ───────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  padding: 18px 36px;
  border-bottom: 1px solid #c4d4c6;
  background-color: #ffffff !important;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 5;
  box-shadow: var(--shadow-sm);
}
.tb-title { font-family: 'Space Mono', monospace; font-size: 15px; font-weight: 700; color: #162119; }
.tb-time  { font-family: 'Space Mono', monospace; font-size: 13px; color: #6b9278; margin-left: auto; }

.content { flex: 1; padding: 32px 36px; }

/* ─────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────── */
.card {
  background-color: #ffffff !important;
  border: 1px solid #c4d4c6; border-radius: 12px;
  padding: 28px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: #6b9278; margin-bottom: 22px;
  padding-bottom: 16px; border-bottom: 1px solid #c4d4c6;
  display: flex; align-items: center; gap: 12px;
}
.badge-admin {
  background-color: #fef9e7 !important; border: 1px solid #f9c74f; color: #9a6600;
  border-radius: 20px; padding: 3px 12px; font-size: 11px; letter-spacing: .5px;
}

/* ─────────────────────────────────────────────
   FORMULARIOS
   ───────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 7px; }
.form-field label {
  font-family: 'Space Mono', monospace;
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #3d5e45;
}
.form-field input {
  background-color: #edf2ee !important; border: 1.5px solid #c4d4c6;
  border-radius: var(--radius); color: #162119 !important;
  font-family: 'Outfit', sans-serif; font-size: 15px;
  padding: 11px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus {
  border-color: #2e7d4f; box-shadow: 0 0 0 3px rgba(46,125,79,.12);
  background-color: #ffffff !important;
}
.form-field input[readonly] { color: #6b9278 !important; cursor: not-allowed; background-color: #e0e9e1 !important; }

.divider { height: 1px; background-color: #c4d4c6; margin: 24px 0; }
.section-sublabel {
  font-family: 'Space Mono', monospace;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: #6b9278; margin-bottom: 16px;
}

/* ─────────────────────────────────────────────
   TABLA DE DATOS
   ───────────────────────────────────────────── */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 15px; table-layout: auto;
}
.data-table thead tr { background-color: #edf2ee !important; border-bottom: 2px solid #c4d4c6; }
.data-table th {
  padding: 13px 18px; text-align: left;
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: #6b9278; font-weight: 700; white-space: nowrap;
}
.data-table td {
  padding: 13px 18px; border-bottom: 1px solid #c4d4c6;
  color: #162119 !important; vertical-align: middle; white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background-color: #edf2ee !important; }
.data-table tr.row-inactive td { opacity: .5; }
.data-table th:last-child, .data-table td:last-child { width: 1%; white-space: nowrap; }

.mono { font-family: 'Space Mono', monospace; font-size: 14px; }

/* ── Badges ── */
.badge-role, .badge-status, .badge-superadmin {
  display: inline-block; border-radius: 20px;
  padding: 4px 12px; font-size: 12px;
  font-family: 'Space Mono', monospace; white-space: nowrap;
}
.badge-role.admin  { background-color: #e4f2e9 !important; color: #1f5c38; border: 1px solid rgba(46,125,79,.3); }
.badge-role.lider  { background-color: #e8f0fb !important; color: #1a4a8a; border: 1px solid rgba(26,74,138,.3); }
.badge-role.client { background-color: #e0e9e1 !important; color: #3d5e45; border: 1px solid #c4d4c6; }
.badge-status.active   { background-color: #e6f9ee !important; color: #1a6b3c; border: 1px solid #8ecfaa; }
.badge-status.inactive { background-color: #f4f4f4 !important; color: #6b9278; border: 1px solid #c4d4c6; }
.badge-superadmin { background-color: #fef9e7 !important; color: #9a6600; border: 1px solid #f9c74f; font-weight: 700; }

/* ── Acciones ── */
.table-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 7px;
  font-size: 17px; text-decoration: none;
  border: 1px solid #c4d4c6; background-color: #ffffff !important;
  cursor: pointer; transition: all .15s; color: #3d5e45;
  line-height: 1;
}
.action-btn.edit:hover   { background-color: #e4f2e9 !important; border-color: #2e7d4f; color: #2e7d4f; }
.action-btn.delete       { background: none; border: 1px solid #c4d4c6; font-family: inherit; }
.action-btn.delete:hover { background-color: #fcecea !important; border-color: #b03a2e; }
.action-btn.disabled     { opacity: .3; cursor: default; pointer-events: none; }

/* ── Checkbox ── */
.checkbox-label {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; font-size: 15px; color: #3d5e45;
  padding: 12px 16px; border: 1.5px solid #c4d4c6;
  border-radius: var(--radius); background-color: #edf2ee !important;
  transition: all .15s;
}
.checkbox-label:hover { border-color: #2e7d4f; background-color: #e4f2e9 !important; }
.checkbox-label.disabled { opacity: .6; cursor: not-allowed; }
.checkbox-label input[type=checkbox] { width: 17px; height: 17px; accent-color: #2e7d4f; flex-shrink: 0; }

/* ─────────────────────────────────────────────
   SCROLLBAR
   ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background-color: #edf2ee; }
::-webkit-scrollbar-thumb { background-color: #c4d4c6; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background-color: #6b9278; }

/* ─────────────────────────────────────────────
   API KEYS
   ───────────────────────────────────────────── */
.apikey-value {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  color: var(--text);
  letter-spacing: .3px;
}
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  margin-left: 8px;
  transition: all .15s;
  vertical-align: middle;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); background-color: var(--accent-lt); }

/* ─────────────────────────────────────────────
   DISPOSITIVOS
   ───────────────────────────────────────────── */
.apikey-short {
  background-color: var(--panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text2);
}
.badge-firmware {
  background-color: #eaf3fb;
  border: 1px solid #aacde8;
  color: #1a5276;
  border-radius: 20px;
  padding: 3px 10px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
}
.form-select {
  background-color: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,125,79,.1);
  background-color: #ffffff;
}
