/* ============================================================
   KRONOS v3 — Componentes UI reutilizables
   ============================================================ */

/* ── SIDEBAR ─────────────────────────────────────────────── */
.logo {
  padding: 18px 16px 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.nav { padding: 8px; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text2);
  font-size: 13.5px;
  transition: all .15s;
  margin-bottom: 1px;
  user-select: none;
}

.nav-item:hover  { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.nav-icon { width: 17px; height: 17px; opacity: .65; flex-shrink: 0; }
.nav-item.active .nav-icon,
.nav-item:hover  .nav-icon { opacity: 1; }

.sidebar-bottom {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
}

.user-pill:hover { background: var(--bg3); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  text-transform: uppercase;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.admin-av { background: linear-gradient(135deg, var(--accent), #f472b6); }
.avatar.guest-av { background: linear-gradient(135deg, #0e7490, #34d399); }

.user-info .name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.user-info .role { font-size: 11px; color: var(--text3); }

/* ── TOPBAR ──────────────────────────────────────────────── */
.page-title { font-size: 15px; font-weight: 500; flex: 1; min-width: 0; }

.running-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--green);
  font-family: var(--mono);
  white-space: nowrap;
}

.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.4s infinite;
  flex-shrink: 0;
}

/* ── BADGES ──────────────────────────────────────────────── */
.admin-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), #f472b6);
  color: white; letter-spacing: .03em;
}

.guest-badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 600;
  background: var(--green-soft); color: var(--green);
}

.priority-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 500;
}

.priority-badge.low    { background: var(--green-soft);  color: var(--green);  }
.priority-badge.medium { background: var(--amber-soft);  color: var(--amber);  }
.priority-badge.high   { background: var(--red-soft);    color: var(--red);    }
.priority-badge.none   { background: var(--bg3);         color: var(--text3);  }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--accent);   color: white; }
.btn-primary:hover:not(:disabled)  { background: var(--accent2); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(248,113,113,.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,.2); }

.btn-green {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52,211,153,.2);
}
.btn-green:hover:not(:disabled) { background: rgba(52,211,153,.2); }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px;  font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

/* Header buttons */
.hdr-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.hdr-btn:hover { background: var(--bg3); color: var(--text); }
.hdr-btn-primary { background: var(--accent); border-color: transparent; color: white; }
.hdr-btn-primary:hover { background: var(--accent2); }

/* Icon buttons */
.icon-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.icon-btn:hover        { background: var(--bg4); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn.success:hover{ background: var(--green-soft); color: var(--green); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus  { border-color: var(--accent); }

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text3); }

.form-input[readonly],
.form-select[disabled] { opacity: .5; cursor: not-allowed; }

.form-select option { background: var(--bg3); }

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; display: none; }

/* ── COLOR SWATCHES ──────────────────────────────────────── */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }

.color-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s, border-color .15s;
}
.color-swatch:hover   { transform: scale(1.12); }
.color-swatch.selected { border-color: white; box-shadow: 0 0 0 2px var(--accent); }

/* ── MODALS ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 480px; max-width: 94vw;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(10px);
  transition: transform .2s;
  animation: slideInUp .2s ease;
}

.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg  { width: 640px; }
.modal-sm  { width: 360px; }

.modal-title {
  font-size: 17px; font-weight: 600;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}

.modal-footer {
  display: flex; justify-content: flex-end;
  gap: 10px; margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── CARDS ───────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }

.card-top {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-icon-wrap {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.card-title   { font-size: 14.5px; font-weight: 500; margin-bottom: 4px; }
.card-subtitle{ font-size: 12px; color: var(--text2); }
.card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.card:hover .card-actions { opacity: 1; }
.color-bar    { height: 3px; border-radius: 2px; margin-top: 14px; }

/* ── STATS ───────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.stat-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3); margin-bottom: 8px;
}

.stat-value {
  font-size: 24px; font-weight: 600;
  font-family: var(--mono); letter-spacing: -.02em;
}

.stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ── TABLES ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--text3); text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px; vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg3); }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%; display: inline-block;
}
.status-dot.on  { background: var(--green); }
.status-dot.off { background: var(--text3); }

/* ── EMPTY STATES ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text3); grid-column: 1/-1;
}
.empty-icon  { width: 48px; height: 48px; background: var(--bg3); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty-title { font-size: 15px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.empty-desc  { font-size: 13px; }

/* ── TOASTS ──────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  animation: slideInRight .22s ease;
  max-width: 320px;
  pointer-events: all;
  box-shadow: var(--shadow-md);
}

/* ── SPINNER ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

.spinner-lg { width: 28px; height: 28px; border-width: 3px; }

.loading-block {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; gap: 12px; color: var(--text3); font-size: 13px;
}

/* ── MULTISELECT ─────────────────────────────────────────── */
.multiselect-wrap { position: relative; }

.multiselect-btn {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: border-color .15s;
}
.multiselect-btn:focus,
.multiselect-btn.open { border-color: var(--accent); color: var(--text); }

.multiselect-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  z-index: 200; max-height: 200px; overflow-y: auto;
  display: none; box-shadow: var(--shadow-lg);
}
.multiselect-dropdown.open { display: block; }

.ms-option {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer;
  font-size: 13px; transition: background .1s;
}
.ms-option:hover { background: var(--bg4); }
.ms-option input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }

/* ── PROFILE SECTIONS ────────────────────────────────────── */
.profile-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.profile-section-title {
  font-size: 11px; font-weight: 600;
  color: var(--text2); margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: .07em;
}

/* ── AUTH ────────────────────────────────────────────────── */
#auth-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}

.auth-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 380px; max-width: 92vw;
  animation: slideInUp .25s ease;
}

.auth-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px; font-size: 20px; font-weight: 600;
}

.auth-logo-icon {
  width: 36px; height: 36px;
  background: var(--accent); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
