/* =====================================================
   Internship Dashboard - styles
   ===================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #111827;
  --primary-dark: #000000;
  --green: #111827;
  --red: #111827;
  --amber: #6b7280;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --sidebar: #111827;
  --radius: 12px;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------------- Login ---------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #000000, #111827 55%, #374151);
  padding: 20px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 22px; margin-top: 10px; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.logo-badge {
  width: 52px; height: 52px; margin: 0 auto;
  background: #ffffff; color: #111827; border: 1px solid #111827;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 20px; border-radius: 14px;
}

/* ---------------- Layout ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .logo-badge { width: 40px; height: 40px; font-size: 16px; margin: 0; }
.sidebar-brand strong { color: #fff; display: block; font-size: 15px; }
.sidebar-brand span { font-size: 12px; color: #94a3b8; }
.sidebar-nav { padding: 14px 10px; flex: 1; }
.sidebar-nav a {
  display: block; padding: 10px 14px; margin: 2px 0; border-radius: 8px;
  color: #cbd5e1; font-weight: 500;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: #ffffff; color: #111827; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 16px 14px 6px; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #ffffff; color: #111827; border: 1px solid #111827;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  flex-shrink: 0;
}
.user-chip-meta strong { display: block; color: #fff; font-size: 13px; }
.user-chip-meta span { font-size: 12px; color: #94a3b8; }
.logout-link { display: block; margin-top: 12px; font-size: 13px; color: #94a3b8; }

.main { flex: 1; min-width: 0; padding: 28px 32px; }
.content { max-width: 1100px; margin: 0 auto; }

/* ---------------- Cards ---------------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; }
.stat-green .stat-value { color: var(--green); }
.stat-red .stat-value { color: var(--red); }
.stat-amber .stat-value { color: var(--amber); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 24px;
}
.card h2 { font-size: 17px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--muted); margin-bottom: 24px; }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr:hover td { background: #f8fafc; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge-working { background: #e5e7eb; color: #111827; }
.badge-not-working { background: #111827; color: #ffffff; }
.badge-pending { background: #f3f4f6; color: #111827; border: 1px solid #111827; }
.badge-role { background: #d1d5db; color: #111827; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-block; border: none; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; color: #111827; border: 1px solid #111827; }
.btn-danger:hover { background: #111827; color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-block { width: 100%; margin-top: 18px; padding: 12px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---------------- Alerts ---------------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.alert-success { background: #e5e7eb; color: #111827; }
.alert-error { background: #111827; color: #ffffff; }

/* ---------------- Intern cards / profile ---------------- */
.intern-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.intern-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; display: flex; gap: 14px;
}
.intern-card .avatar { width: 46px; height: 46px; font-size: 18px; }
.intern-card-meta strong { display: block; font-size: 15px; }
.intern-card-meta .sub { color: var(--muted); font-size: 13px; }
.intern-card-actions { margin-top: 10px; display: flex; gap: 8px; }

.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.profile-header .avatar { width: 72px; height: 72px; font-size: 28px; }

/* ---------------- Misc ---------------- */
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.inline-form { display: inline; }

@media (max-width: 768px) {
  .app { display: block; }
  .main { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 1000;
  background: var(--sidebar); color: #fff;
  align-items: center; gap: 10px; padding: 10px 14px;
}
.topbar strong { font-size: 15px; }
.hamburger {
  display: none;
  background: transparent; border: none; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 8px 2px 2px;
}
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  .topbar { display: flex; }
  .hamburger { display: inline-flex; }
  .sidebar {
    position: fixed; top: 0; left: -260px; width: 250px; height: 100vh;
    z-index: 1002; transition: left .25s ease;
  }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5);
    z-index: 1001; opacity: 0; visibility: hidden; transition: opacity .25s;
  }
  .sidebar-overlay.show { opacity: 1; visibility: visible; }

  .main { padding: 14px; }
  .content { padding: 0; }
  .page-title { font-size: 20px; }
  .page-subtitle { margin-bottom: 16px; }

  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 24px; }

  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-bar .form-group { min-width: 0; flex: none; }
  .filter-bar .btn { width: 100%; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; text-align: center; }

  .metric-grid, .chart-grid { grid-template-columns: 1fr; }
  .chart-box { height: 190px; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 620px; }
  th, td { padding: 10px 8px; }

  .profile-header { flex-direction: column; align-items: flex-start; }
  .profile-header .avatar { width: 60px; height: 60px; font-size: 24px; }

  .btn { padding: 10px 14px; }
  .btn-sm { padding: 8px 12px; }

  .card { padding: 16px; }
  .tabs { gap: 6px; }
  .tabs a { padding: 8px 12px; }

  .login-card { padding: 26px 20px; }
  .toast { font-size: 13px; padding: 12px 14px; }
  .toast-container { top: 12px; right: 12px; left: 12px; }

  .certificate { padding: 28px 18px; }
  .certificate .cert-title { font-size: 30px; }
  .certificate .cert-name { font-size: 26px; }
  .certificate-page { padding: 8px; }

  .no-print { flex-wrap: wrap; }
}

/* =====================================================
   MVP UPGRADE styles
   ===================================================== */

/* ---- Status / priority badges ---- */
.badge-active { background: #e5e7eb; color: #111827; }
.badge-completed { background: #d1d5db; color: #111827; }
.badge-dropped { background: #111827; color: #ffffff; }
.badge-priority-high { background: #111827; color: #ffffff; }
.badge-priority-medium { background: #e5e7eb; color: #111827; }
.badge-priority-low { background: #f3f4f6; color: #111827; border: 1px solid #9ca3af; }
.badge-todo { background: #e5e7eb; color: #111827; }
.badge-in_progress { background: #d1d5db; color: #111827; }
.badge-att-present { background: #e5e7eb; color: #111827; }
.badge-att-absent { background: #111827; color: #ffffff; }
.badge-att-late { background: #f3f4f6; color: #111827; border: 1px solid #9ca3af; }

/* ---- Avatar image ---- */
.avatar-img { object-fit: cover; border-radius: 50%; width: 46px; height: 46px; }
.profile-header .avatar-img { width: 72px; height: 72px; font-size: 28px; }

/* ---- Charts ---- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.chart-card h3 { font-size: 14px; margin-bottom: 12px; color: var(--muted); font-weight: 600; }
.chart-box { position: relative; height: 170px; }

/* ---- Filter / search bar ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; flex: 1 1 180px; }
.filter-bar .btn { white-space: nowrap; }

/* ---- Progress bars ---- */
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; background: #111827; border-radius: 999px; }
.progress-bar.green { background: #111827; }
.progress-bar.amber { background: #6b7280; }
.progress-bar.red { background: #d1d5db; }

/* ---- Attendance dots ---- */
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: none; }
.att-row .grow { flex: 1; }
.att-num { font-weight: 700; font-size: 15px; min-width: 40px; }
.att-num.green { color: var(--green); }
.att-num.amber { color: var(--amber); }
.att-num.red { color: var(--red); }

/* ---- Toasts ---- */
.toast-container { position: fixed; top: 18px; right: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #fff; box-shadow: 0 10px 25px rgba(0,0,0,.18); animation: toast-in .25s ease; }
.toast-success { background: #111827; }
.toast-error { background: #111827; }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ---- Intern cards grid ---- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---- Tab bar ---- */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 8px; background: var(--card); border: 1px solid var(--border); font-weight: 600; color: var(--muted); }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabs a:hover { text-decoration: none; }

/* ---- Certificate ---- */
.certificate-page { display: flex; justify-content: center; padding: 20px; }
.certificate {
  width: 100%; max-width: 850px; background: #fff; border: 10px solid var(--primary);
  outline: 2px solid var(--primary); outline-offset: 4px; padding: 48px 56px; text-align: center;
}
.certificate .cert-title { font-size: 40px; font-weight: 800; color: var(--primary); letter-spacing: .04em; margin-bottom: 8px; }
.certificate .cert-sub { color: var(--muted); font-size: 15px; margin-bottom: 34px; }
.certificate .cert-body { font-size: 16px; color: var(--text); line-height: 1.8; }
.certificate .cert-name { font-size: 34px; font-weight: 800; color: #111827; border-bottom: 2px solid var(--border); display: inline-block; padding: 0 30px 6px; margin: 8px 0 14px; }
.certificate .cert-detail { font-size: 15px; color: #475569; margin-bottom: 30px; }
.certificate .cert-id { margin-top: 34px; color: var(--muted); font-size: 13px; }

@media print {
  .sidebar, .main > .content .no-print, .toast-container { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .certificate-page { padding: 0; }
  .certificate { border: 8px solid var(--primary); }
}