/* =========================================================
   MicroTask — Design System & Layout
   ========================================================= */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-secondary: #0ea5a4;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-warning: #d97706;
  --color-bg: #f6f8fb;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 12px; font-weight: 700; }
p { margin: 0 0 12px; }

/* ---------- Navbar ---------- */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { font-size: 22px; font-weight: 800; color: var(--color-text); }
.brand span { color: var(--color-primary); }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-links a { color: var(--color-text); font-weight: 500; font-size: 14.5px; }
.nav-links a:hover { color: var(--color-primary); text-decoration: none; }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text);
}
.notif-link { position: relative; }
.badge {
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-secondary); color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Layout ---------- */
.page-content { min-height: 70vh; padding: 32px 0 60px; }
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #1e40af 100%);
  color: #fff;
  padding: 80px 0;
  text-align: center;
}
.hero h1 { font-size: 42px; margin-bottom: 16px; }
.hero p { font-size: 18px; opacity: .92; max-width: 640px; margin: 0 auto 28px; }
.hero .hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.section { padding: 56px 0; }
.section-title { text-align: center; font-size: 28px; margin-bottom: 8px; }
.section-subtitle { text-align: center; color: var(--color-text-muted); margin-bottom: 36px; }

.stats-grid, .grid-3, .grid-4 {
  display: grid;
  gap: 20px;
}
.stats-grid { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); transition: all .15s ease; }

.stat-card { text-align: center; }
.stat-card .stat-value { font-size: 30px; font-weight: 800; color: var(--color-primary); }
.stat-card .stat-label { color: var(--color-text-muted); font-size: 13.5px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Task Card ---------- */
.task-card { display: flex; flex-direction: column; gap: 10px; }
.task-card .task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task-card h3 { margin: 0; font-size: 18px; }
.task-reward { font-size: 20px; font-weight: 800; color: var(--color-success); white-space: nowrap; }
.task-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--color-text-muted); }
.task-desc { color: var(--color-text-muted); font-size: 14.5px; }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2ff;
  color: var(--color-primary);
}
.status-open { background: #dcfce7; color: #15803d; }
.status-in_progress { background: #fef3c7; color: #b45309; }
.status-completed { background: #dbeafe; color: #1d4ed8; }
.status-rejected, .status-closed { background: #fee2e2; color: #b91c1c; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-approved { background: #dcfce7; color: #15803d; }
.status-suspended { background: #fee2e2; color: #b91c1c; }
.status-active { background: #dcfce7; color: #15803d; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="file"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14.5px;
  background: #fff;
  color: var(--color-text);
}
textarea { resize: vertical; min-height: 110px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-hint { font-size: 12.5px; color: var(--color-text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.auth-wrapper {
  max-width: 440px;
  margin: 20px auto;
}
.auth-wrapper .card { padding: 36px; }
.auth-wrapper h1 { text-align: center; font-size: 24px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14.5px; }
.role-select { display: flex; gap: 12px; }
.role-option { flex: 1; }
.role-option input { display: none; }
.role-option label {
  display: block;
  text-align: center;
  padding: 14px 10px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  margin: 0;
}
.role-option input:checked + label {
  border-color: var(--color-primary);
  background: #eef2ff;
  color: var(--color-primary);
}

/* ---------- Alerts ---------- */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 14.5px;
  font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; }
.alert-error { background: #fee2e2; color: #b91c1c; }
.alert-info { background: #dbeafe; color: #1d4ed8; }
.alert-warning { background: #fef3c7; color: #b45309; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
th { background: #f1f5f9; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; font-size: 12px; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }

/* ---------- Dashboard layout ---------- */
.dash-layout { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.dash-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: sticky;
  top: 84px;
}
.dash-sidebar a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--color-text);
  font-weight: 500;
  font-size: 14.5px;
  margin-bottom: 4px;
}
.dash-sidebar a:hover, .dash-sidebar a.active {
  background: #eef2ff;
  color: var(--color-primary);
  text-decoration: none;
}

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  background: var(--color-surface);
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}
.filter-bar input, .filter-bar select { min-width: 160px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-muted); }

.rating-stars { color: #f59e0b; letter-spacing: 2px; }

.footer-links { display: flex; gap: 18px; }
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 22px 0;
  margin-top: 40px;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--color-text-muted); font-size: 14px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-text);
}
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .dash-sidebar a { white-space: nowrap; }
  .stats-grid, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    gap: 14px;
  }
  .nav-links.open { display: flex; }
  .hero h1 { font-size: 30px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .auth-wrapper .card { padding: 24px; }
}
