/* ============================================================
   GreenSkill ERP — Global Design System
   Single source of truth for all UI tokens and component classes.
   Tailwind handles utilities; this file owns:
     - CSS custom properties (design tokens)
     - Scrollbar
     - Animations / keyframes
     - Reusable component classes not expressible as Tailwind utilities
   ============================================================ */

/* ── Design tokens ── */
:root {
  --gs:        #009BCC;
  --gs-dark:   #007A99;
  --gs-light:  #33AED6;
  --gs-soft:   #E5F5FA;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  --border:    #e2e8f0;
  --surface:   #f8fafc;
  --white:     #ffffff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ── Base reset additions ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Inter Tight', ui-sans-serif, system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar         { width: 6px; height: 6px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Keyframes ── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ── Utilities ── */
.animate-fade-in  { animation: fadeIn  0.3s ease; }
.animate-slide-up { animation: slideUp 0.25s ease; }

/* ── Loader spinner ── */
.loader {
  border: 3px solid #f3f3f3;
  border-top-color: var(--gs);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Sidebar navigation ── */
.nav-active {
  background-color: var(--gs-soft);
  color: var(--gs);
  border-right: 3px solid var(--gs);
  font-weight: 600;
}

/* ── Table — sticky action column ── */
.col-sticky-action {
  position: sticky;
  right: 0;
  z-index: 10;
}
.col-sticky-action-header { background-color: rgb(249, 250, 251); }
.col-sticky-action-cell   { background-color: var(--white); }

/* ── Table — shared header / row ── */
.tbl-th {
  padding: 1rem 1.5rem;
  font-weight: 500;
  border-bottom: 1px solid #f3f4f6;
  text-align: center;
  color: #6b7280;
  font-size: 0.8125rem;
}
.tbl-th-sort {
  cursor: pointer;
  transition: background 0.15s;
}
.tbl-th-sort:hover { background-color: #f9fafb; }
.tbl-th-sort.sorted { font-weight: 700; color: var(--gs); }

.tbl-td {
  padding: 1rem 1.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
  overflow: hidden;
}

/* ── Badge / status pill ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-sm {
  padding: 1px 8px;
  font-size: 0.6875rem;
}
/* Colour variants — match existing Tailwind classes for zero-churn migration */
.badge-green  { background: #dcfce7; color: #16a34a; }
.badge-blue   { background: #dbeafe; color: #2563eb; }
.badge-purple { background: #f3e8ff; color: #7c3aed; }
.badge-yellow { background: #fef9c3; color: #ca8a04; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }
.badge-gs     { background: var(--gs-soft); color: var(--gs); }

/* ── Icon-action buttons (edit / delete in table rows) ── */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}
.btn-icon-blue   { color: #3b82f6; } .btn-icon-blue:hover   { background: #eff6ff; }
.btn-icon-red    { color: #ef4444; } .btn-icon-red:hover    { background: #fef2f2; }
.btn-icon-green  { color: #22c55e; } .btn-icon-green:hover  { background: #f0fdf4; }
.btn-icon-purple { color: #a855f7; } .btn-icon-purple:hover { background: #faf5ff; }
.btn-icon-teal   { color: #14b8a6; } .btn-icon-teal:hover   { background: #f0fdfa; }
.btn-icon-gs     { color: var(--gs); } .btn-icon-gs:hover   { background: var(--gs-soft); }

/* ── Primary CTA button ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: linear-gradient(135deg, var(--gs) 0%, var(--gs-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,155,204,0.28);
}
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Secondary / outline button ── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--white);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover:not(:disabled) { background: var(--surface); border-color: #cbd5e1; }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Danger button ── */
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Form input ── */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--gs);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,155,204,0.12);
}
.form-input::placeholder          { color: var(--text-muted); letter-spacing: 0; }
.form-input[type="password"]      { letter-spacing: 3px; }
.form-input[type="password"]::placeholder { letter-spacing: 0; }

/* ── Input with left icon wrapper ── */
.input-wrap      { position: relative; }
.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}
.input-wrap .form-input { padding-left: 40px; }

/* ── Card ── */
.card {
  background: var(--white);
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Modal backdrop ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 50;
  background: var(--white);
  border-left: 4px solid var(--gs);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  min-width: 220px;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Alert boxes ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  margin-bottom: 16px;
  display: none;
  border-left: 4px solid transparent;
}
.alert.show     { display: block; }
.alert-error    { background: #fef2f2; color: #dc2626; border-left-color: #dc2626; animation: shake 0.38s ease; }
.alert-success  { background: #f0fdf4; color: #16a34a; border-left-color: #16a34a; }
.alert-warning  { background: #fffbeb; color: #b45309; border-left-color: #f59e0b; }
.alert-info     { background: #eff6ff; color: #2563eb; border-left-color: #3b82f6; }

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

.panel-image {
  width: 1320px;
  min-width: 0;
  flex-shrink: 1;
  position: relative;
  overflow: hidden;
}
.panel-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.panel-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,60,80,0.18) 0%, rgba(0,30,40,0.28) 100%);
  pointer-events: none;
}

.panel-form {
  width: 600px;
  min-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 64px;
  background: var(--white);
  position: relative;
}
.panel-form .form-inner { width: 100%; max-width: 420px; }

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gs) 0%, var(--gs-dark) 100%);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.brand-text h1 { font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.brand-text p  { font-size: 12px; color: var(--text-secondary); font-weight: 400; margin-top: 1px; }

.form-heading         { margin-bottom: 32px; }
.form-heading h2      { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.form-heading p       { font-size: 14px; color: var(--text-secondary); }

.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.form-group { margin-bottom: 20px; }

.row-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; font-size: 13px;
}
.checkbox-wrap { display: flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text-secondary); }
.checkbox-wrap input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--gs); cursor: pointer; }
.link-forgot { color: var(--gs); font-weight: 600; text-decoration: none; transition: color 0.2s; }
.link-forgot:hover { color: var(--gs-dark); }

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--gs) 0%, var(--gs-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-login:hover:not(:disabled) {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,155,204,0.28);
}
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.panel-form-footer {
  position: absolute;
  bottom: 24px; left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Dropdown animation ── */
#b-course-dropdown,
#peserta-dropdown {
  top: 100%; left: 0; right: 0;
  transition: all 0.2s ease-in-out;
}
#b-course-dropdown:not(.hidden),
#peserta-dropdown:not(.hidden) { animation: fadeIn 0.2s ease-in; }

#b-course-dropdown > div:hover,
#peserta-dropdown  > div:hover {
  background-color: var(--gs-soft) !important;
  transition: background-color 0.15s ease;
}

/* ── Progress bar ── */
.progress-bar {
  height: 8px;
  border-radius: 9999px;
  background: var(--gs);
  transition: width 0.3s ease;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .panel-image { display: none; }
  .panel-form  { width: 100%; min-width: 0; padding: 48px 28px; }
}
