@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Hogar Properties brand — exact from ShiftHQ source */
  --bg:        #14171e;
  --card:      #1a1e27;
  --card2:     #1f2433;
  --border:    #2b303a;
  --gold:      #ff9900;
  --gold-dim:  #cc7a00;
  --gold-bg:   rgba(255,153,0,0.12);
  --gold-fg:   #ffd699;
  --text:      #f2f2f2;
  --muted:     #8e95a3;
  --green:     #1db856;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --radius:    10px;
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-fg); }

/* ── TOPBAR ───────────────────────────────────────────────────────── */
.topbar {
  background: rgba(20,23,30,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-logo {
  height: 28px;
  width: auto;
}
.topbar-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.1px;
}
.topbar-name span {
  color: var(--muted);
  font-weight: 400;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 0.8rem; color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-bg);
  border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; color: var(--gold);
  cursor: pointer; flex-shrink: 0;
}

/* ── BUTTONS ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 7px;
  font-size: 0.85rem; font-weight: 500;
  border: none; cursor: pointer; transition: all 0.15s;
  font-family: var(--font);
}
.btn-gold { background: var(--gold); color: #0a0a0a; }
.btn-gold:hover { background: var(--gold-fg); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost { background: transparent; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--card2); border-radius: 6px; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ── LOGIN PAGE ───────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255,153,0,0.07) 0%, transparent 70%), var(--bg);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.login-logo {
  text-align: center; margin-bottom: 32px;
}
.login-logo img {
  height: 44px; width: auto; margin-bottom: 14px;
}
.login-logo h1 {
  font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.login-logo p {
  font-size: 0.75rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.2px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.75rem; color: var(--muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 500;
}
.form-group input {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text); padding: 10px 13px;
  border-radius: 7px; font-size: 0.9rem;
  outline: none; transition: border 0.15s;
  font-family: var(--font);
}
.form-group input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,153,0,0.1); }
.form-group input::placeholder { color: var(--muted); }
.login-btn { width: 100%; margin-top: 6px; padding: 11px; font-size: 0.95rem; justify-content: center; }
.login-error {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25);
  color: #f87171; padding: 10px 13px; border-radius: 7px;
  font-size: 0.85rem; margin-bottom: 14px; display: none;
}
.login-error.show { display: block; }

/* ── LAYOUT ───────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 56px); }
.main-content { flex: 1; padding: 28px; overflow-y: auto; }

/* ── SIDEBAR ──────────────────────────────────────────────────────── */
.sidebar {
  width: 220px; background: var(--card);
  border-right: 1px solid var(--border);
  padding: 12px 0; flex-shrink: 0;
}
.sidebar-section {
  padding: 6px 14px 2px;
  font-size: 0.65rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px; color: var(--muted);
  font-size: 0.875rem; cursor: pointer;
  transition: all 0.12s; border-left: 2px solid transparent;
  margin: 1px 0;
}
.sidebar-item:hover { color: var(--text); background: var(--gold-bg); }
.sidebar-item.active {
  color: var(--gold); background: var(--gold-bg);
  border-left-color: var(--gold); font-weight: 500;
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── SECTION TITLE ────────────────────────────────────────────────── */
.section-title {
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 14px;
}

/* ── COURSE GRID ──────────────────────────────────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; margin-bottom: 32px;
}
.course-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: all 0.18s; position: relative; overflow: hidden;
}
.course-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gold); opacity: 0; transition: opacity 0.18s;
}
.course-card:hover { border-color: rgba(255,153,0,0.35); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.course-card:hover::before { opacity: 1; }
.course-card.complete { border-color: rgba(29,184,86,0.25); }
.course-card.complete::before { background: var(--green); opacity: 1; }
.course-badge {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--gold); margin-bottom: 8px;
}
.course-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; line-height: 1.4; }
.progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--gold); transition: width 0.4s ease; }
.progress-fill.complete { background: var(--green); }
.progress-text { font-size: 0.75rem; color: var(--muted); }
.complete-badge {
  position: absolute; top: 12px; right: 12px;
  background: rgba(29,184,86,0.12); color: var(--green);
  font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
}

/* ── COURSE DETAIL LAYOUT ─────────────────────────────────────────── */
.course-layout { display: flex; height: calc(100vh - 56px); overflow: hidden; }
.unit-sidebar {
  width: 290px; background: var(--card);
  border-right: 1px solid var(--border); overflow-y: auto; flex-shrink: 0;
}
.unit-sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.unit-sidebar-header .back {
  font-size: 0.75rem; color: var(--muted); display: flex;
  align-items: center; gap: 4px; margin-bottom: 10px;
}
.unit-sidebar-header h2 { font-size: 0.875rem; font-weight: 600; line-height: 1.4; }
.unit-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s;
}
.unit-item:hover { background: var(--card2); }
.unit-item.active { background: var(--gold-bg); border-left: 2px solid var(--gold); }
.unit-item.done .unit-icon { color: var(--green); }
.unit-icon { width: 18px; text-align: center; font-size: 0.8rem; color: var(--muted); flex-shrink: 0; margin-top: 1px; }
.unit-info { flex: 1; min-width: 0; }
.unit-name { font-size: 0.82rem; line-height: 1.35; }
.unit-type-badge { font-size: 0.68rem; color: var(--muted); margin-top: 2px; }

/* ── VIDEO AREA ───────────────────────────────────────────────────── */
.video-area { flex: 1; display: flex; flex-direction: column; background: #06080c; overflow: hidden; }
.video-container { position: relative; background: #000; flex: 1; min-height: 0; }
.video-js { width: 100% !important; height: 100% !important; }
.video-js .vjs-big-play-button {
  background: rgba(255,153,0,0.9); border: none;
  border-radius: 50%; width: 56px; height: 56px; line-height: 56px;
  left: 50%; top: 50%; transform: translate(-50%,-50%);
}
.video-js .vjs-big-play-button:hover { background: var(--gold-fg); }
.video-js .vjs-control-bar { background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, transparent 100%); }
.video-js .vjs-play-progress { background: var(--gold); }
.video-js .vjs-volume-level { background: var(--gold); }
.video-js .vjs-progress-holder { cursor: not-allowed; }

/* ── WATERMARK ────────────────────────────────────────────────────── */
.watermark {
  position: absolute; pointer-events: none; user-select: none; z-index: 50;
  font-size: 12px; font-weight: 600; font-family: var(--font);
  color: rgba(255,255,255,0.14); text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  transition: top 1.5s ease, left 1.5s ease; white-space: nowrap;
}

/* ── OVERLAYS ─────────────────────────────────────────────────────── */
.overlay {
  position: absolute; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(6,8,12,0.9); backdrop-filter: blur(10px);
  pointer-events: auto;
}
.overlay.hidden { display: none !important; }
.overlay-icon { font-size: 2.8rem; margin-bottom: 14px; }
.overlay-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.overlay-msg { color: var(--muted); font-size: 0.875rem; text-align: center; max-width: 300px; line-height: 1.6; }
.overlay-restart { margin-top: 20px; }

.screenshare-overlay {
  position: absolute; inset: 0; z-index: 999;
  background: #06080c; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.screenshare-overlay.hidden { display: none; }
.screenshare-overlay h2 { color: var(--red); font-size: 1.3rem; }
.screenshare-overlay p { color: var(--muted); max-width: 340px; text-align: center; font-size: 0.875rem; line-height: 1.6; }

/* ── VIDEO INFO BAR ───────────────────────────────────────────────── */
.video-info-bar {
  background: var(--card); border-top: 1px solid var(--border);
  padding: 11px 20px; display: flex; align-items: center; gap: 16px; flex-shrink: 0;
}
.video-title { font-size: 0.875rem; font-weight: 600; flex: 1; }
.video-progress-text { font-size: 0.78rem; color: var(--muted); }
.completion-badge {
  background: rgba(29,184,86,0.12); color: var(--green);
  font-size: 0.78rem; font-weight: 700; padding: 4px 12px; border-radius: 20px;
}

/* ── ADMIN ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--gold); line-height: 1; }
.stat-value.green { color: var(--green); }

/* ── TABLE ────────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  background: var(--card2); text-align: left;
  padding: 11px 15px; font-size: 0.72rem;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
td { padding: 11px 15px; font-size: 0.875rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }
.agent-name { font-weight: 600; }
.pill {
  display: inline-block; padding: 2px 9px;
  border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.pill-gold { background: var(--gold-bg); color: var(--gold); }
.pill-green { background: rgba(29,184,86,0.12); color: var(--green); }
.pill-red { background: rgba(239,68,68,0.12); color: var(--red); }

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  z-index: 200; display: flex; align-items: center;
  justify-content: center; padding: 20px; backdrop-filter: blur(4px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 860px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 22px; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: 4px; border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--card2); }

/* ── CHARTS ───────────────────────────────────────────────────────── */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.chart-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.chart-title {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--muted); margin-bottom: 14px;
}

/* ── MISC ─────────────────────────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); font-size: 0.875rem; }
.empty { text-align: center; padding: 48px; color: var(--muted); font-size: 0.875rem; }
.tag { font-size: 0.68rem; font-weight: 600; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.4px; }
.tag-video { background: rgba(59,130,246,0.12); color: var(--blue); }
.tag-test { background: var(--gold-bg); color: var(--gold); }

@media (max-width: 768px) {
  .course-layout { flex-direction: column; }
  .unit-sidebar { width: 100%; height: 200px; }
  .chart-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
