/* =====================================================
   GREEN & GLOBAL PLATFORM — STYLES
   ===================================================== */

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

:root {
  --green-deep: #14352A;
  --green-mid: #1B5E3F;
  --green-accent: #2A7B54;
  --green-light: #E8F5EE;
  --gold: #C49A3C;
  --gold-light: #D4AF5B;
  --gold-bg: #FFF8EB;
  --cream: #F6F3EC;
  --warm-white: #FAFAF7;
  --text-dark: #1A1D1B;
  --text-body: #3A3D3B;
  --text-muted: #6B6E6C;
  --border: #E2DFD6;
  --border-strong: #C8C4BA;
  --danger: #C53030;
  --danger-bg: #FFF5F5;
  --warning: #DD6B20;
  --warning-bg: #FFFAF0;
  --success: #2A7B54;
  --success-bg: #E8F5EE;
  --radius: 8px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text-body);
  background: #F0EDE6;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- AUTH SCREEN ---- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--green-deep);
  padding: 1rem;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
  justify-content: center;
}
.auth-logo-dot {
  width: 36px; height: 36px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.auth-logo-dot svg { width: 18px; height: 18px; }
.auth-logo span {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
}
.auth-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: .25rem;
  text-align: center;
}
.auth-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-align: center;
}
.auth-message {
  padding: .6rem .75rem;
  border-radius: 6px;
  font-size: .82rem;
  margin-bottom: 1rem;
  display: none;
}
.auth-error { background: var(--danger-bg); color: var(--danger); }
.auth-success { background: var(--success-bg); color: var(--success); }
.auth-form .form-group { margin-bottom: .75rem; }
.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: .78rem;
  margin: 1rem 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-google-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-dark);
}
.auth-google-btn:hover { background: var(--cream); border-color: var(--border-strong); }
.auth-switch {
  text-align: center;
  margin-top: 1rem;
  font-size: .82rem;
  color: var(--text-muted);
}
.auth-switch a {
  color: var(--green-accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

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

.sidebar {
  width: 240px;
  background: var(--green-deep);
  color: #fff;
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform .3s;
}
.sidebar-logo {
  padding: 0 1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo-dot {
  width: 28px; height: 28px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-dot svg { width: 14px; height: 14px; }
.sidebar-logo span {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
}
.sidebar-nav { flex: 1; overflow-y: auto; }

.nav-section { padding: 0 .75rem; margin-bottom: .5rem; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .5rem .5rem .25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: var(--green-deep);
  font-size: .65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
}
.nav-badge-danger { background: var(--danger); color: #fff; }

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  color: rgba(255,255,255,.7);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: .8rem;
  font-weight: 500;
  color: rgba(255,255,255,.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: .68rem;
  color: rgba(255,255,255,.35);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 4px;
  font-size: .8rem;
}
.sidebar-logout:hover { color: rgba(255,255,255,.7); }

.main { margin-left: 240px; flex: 1; min-height: 100vh; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; }
.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--text-dark); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-dark);
  padding: 4px;
}
.content { padding: 1.5rem 2rem 3rem; }

/* ---- CARDS ---- */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--text-dark); }

/* ---- STATS ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.stat-card-label {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-card-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-dark);
}
.stat-card-sub {
  font-size: .72rem;
  font-weight: 500;
  margin-top: 2px;
  color: var(--text-muted);
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary { background: var(--green-accent); color: #fff; }
.btn-primary:hover { background: var(--green-mid); }
.btn-gold { background: var(--gold); color: var(--green-deep); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-body); }
.btn-outline:hover { border-color: var(--border-strong); background: var(--cream); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a52929; }
.btn-block { width: 100%; justify-content: center; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--cream); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--cream); color: var(--text-muted); }
.badge-gold { background: var(--gold-bg); color: #92700E; }

/* ---- PROGRESS ---- */
.progress-bar {
  height: 6px;
  background: var(--cream);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s;
}
.progress-green { background: var(--green-accent); }
.progress-gold { background: var(--gold); }
.progress-danger { background: var(--danger); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
}

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #fff;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--green-accent);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ---- COMPLIANCE DETAIL ---- */
.compliance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.compliance-client-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-dark);
}
.compliance-score { text-align: right; }
.compliance-score-num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 600;
}
.score-high { color: var(--success); }
.score-mid { color: var(--warning); }
.score-low { color: var(--danger); }

/* ---- COURSE CARDS ---- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.course-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: all .2s;
}
.course-card:hover {
  border-color: var(--green-accent);
  box-shadow: 0 4px 16px rgba(20,53,42,.06);
}
.course-banner { height: 8px; }
.course-banner-green { background: linear-gradient(90deg, var(--green-accent), var(--green-mid)); }
.course-banner-gold { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.course-body { padding: 1.25rem; }
.course-category {
  font-size: .68rem;
  font-weight: 600;
  color: var(--green-accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .5rem;
}
.course-title { font-size: 1rem; font-weight: 600; color: var(--text-dark); margin-bottom: .5rem; }
.course-desc { font-size: .82rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 1rem; }
.course-meta { display: flex; gap: 1rem; font-size: .72rem; color: var(--text-muted); }
.course-actions {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---- ALERTS ---- */
.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  font-size: .82rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(221,107,32,.15); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(42,123,84,.15); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(197,48,48,.15); }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state p { color: var(--text-muted); font-size: .9rem; margin-bottom: 1rem; }

/* ---- LOADING ---- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  font-size: .9rem;
}
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--green-accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- GRID LAYOUTS ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle { display: block; }
  .content { padding: 1rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .courses-grid { grid-template-columns: 1fr; }
  .compliance-header { flex-direction: column; }
}
