/* ================================================
   main.css — SkillPort Global Design System
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #eff6ff;
  --primary-hover: #1c4ed8;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --white: #ffffff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-50); line-height: 1.6; -webkit-font-smoothing: antialiased; }

h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; color: var(--gray-900); }
h1 { font-size: 2.25rem; } h2 { font-size: 1.875rem; } h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; } h5 { font-size: 1.125rem; }
p { color: var(--gray-600); line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem; border: none; border-radius: var(--radius-md);
  font-family: var(--font); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all 180ms ease; white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); padding: 1.5rem; }
.card-header { padding-bottom: 1rem; border-bottom: 1px solid var(--gray-100); margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; }

/* ── Top Nav ── */
.top-nav {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 1.5rem; height: 64px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 200;
  box-shadow: var(--shadow-sm);
}
.nav-logo { display: flex; align-items: center; gap: 0.75rem; font-weight: 800; font-size: 1.25rem; color: var(--primary); text-decoration: none; }
.nav-logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.nav-user-info { text-align: right; }
.nav-user-name { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); display: block; }
.nav-user-role { font-size: 0.75rem; color: var(--gray-500); }
.nav-avatar { width: 38px; height: 38px; background: var(--primary-light); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; font-size: 0.875rem; flex-shrink: 0; }
.btn-logout { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.875rem; background: transparent; border: 1px solid var(--gray-300); border-radius: var(--radius-md); color: var(--gray-600); font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: all 180ms; font-family: var(--font); }
.btn-logout:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

/* ── Layout ── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.875rem; }
.page-header p { color: var(--gray-500); margin-top: 0.25rem; }

/* ── Grid ── */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ── Progress ── */
.progress-bar { height: 6px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width 400ms ease; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { background: var(--gray-50); padding: 0.75rem 1rem; text-align: left; font-weight: 600; color: var(--gray-700); border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.375rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 0.625rem 0.875rem; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md); font-family: var(--font); font-size: 0.9375rem;
  color: var(--gray-800); background: var(--white); transition: border-color 180ms, box-shadow 180ms; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
input::placeholder { color: var(--gray-400); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity 200ms; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); padding: 2rem; width: 90%; max-width: 520px; transform: scale(0.96) translateY(-8px); transition: transform 200ms; }
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 2px; border-radius: 4px; font-size: 1.25rem; line-height: 1; }
.modal-close:hover { color: var(--gray-700); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Alerts ── */
.alert { padding: 0.875rem 1rem; border-radius: var(--radius-md); border: 1px solid; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 0.625rem; }
.alert-info { background: var(--primary-light); border-color: #bfdbfe; color: #1e40af; }
.alert-success { background: var(--success-light); border-color: #a7f3d0; color: #065f46; }
.alert-warning { background: var(--warning-light); border-color: #fde68a; color: #92400e; }
.alert-danger { background: var(--danger-light); border-color: #fecaca; color: #991b1b; }

/* ── Stat Cards ── */
.stat-card { background: var(--white); border-radius: var(--radius-xl); border: 1px solid var(--gray-200); padding: 1.5rem; display: flex; align-items: flex-start; gap: 1rem; }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-value { font-size: 1.875rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 0.8125rem; color: var(--gray-500); margin-top: 0.25rem; }

/* ── Utilities ── */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; } .gap-3 { gap: 0.75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.w-full { width: 100%; } .text-center { text-align: center; } .text-right { text-align: right; }
.text-sm { font-size: 0.875rem; } .text-xs { font-size: 0.75rem; } .font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.text-primary { color: var(--primary); } .text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-muted { color: var(--gray-500); }
.mt-1 { margin-top: 0.25rem; } .mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; } .mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--gray-200); margin: 1.5rem 0; }
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.search-wrap { position: relative; }
.search-wrap input { padding-left: 2.5rem; }
.search-wrap .search-ico { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .main-content { padding: 1rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .top-nav { padding: 0 1rem; }
  .nav-user-info { display: none; }
  h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; }
}
