/* portal.css — Tech to School Customer Portal */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-hover: #f0f2f7;
  --border: #e3e6ed;
  --border-light: #f0f1f5;
  --text: #1a1f36;
  --text-secondary: #525f7f;
  --text-muted: #8792a2;
  --accent: #0052cc;
  --accent-hover: #0043a8;
  --accent-light: rgba(0, 82, 204, 0.08);
  --green: #0e9f6e;
  --green-bg: rgba(14, 159, 110, 0.08);
  --green-border: rgba(14, 159, 110, 0.2);
  --red: #e02424;
  --red-bg: rgba(224, 36, 36, 0.08);
  --red-border: rgba(224, 36, 36, 0.2);
  --yellow: #c27803;
  --yellow-bg: rgba(194, 120, 3, 0.08);
  --yellow-border: rgba(194, 120, 3, 0.2);
  --blue-bg: rgba(0, 82, 204, 0.08);
  --blue-border: rgba(0, 82, 204, 0.2);
  --purple: #6c5ce7;
  --purple-bg: rgba(108, 92, 231, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --topbar-height: 60px;
  --sidebar-width: 240px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ─────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--topbar-height);
  background: #000000;
  border-bottom: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.topbar-logo img {
  height: 32px;
  width: auto;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  background: #333;
}

.topbar-org {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-notif {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  transition: background 0.15s;
}

.topbar-notif:hover {
  background: #1a1a1a;
  color: #fff;
}

.topbar-notif .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #000;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ── Layout ─────────────────────────────────── */
.layout {
  display: flex;
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a.active svg {
  opacity: 1;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 20px 12px 8px;
}

/* ── Main content ───────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Cards ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* ── Stat cards (dashboard) ─────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stat-card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Status badges ──────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.badge-green  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-red    { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-blue   { background: var(--blue-bg); color: var(--accent); border: 1px solid var(--blue-border); }
.badge-gray   { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Tables ─────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr { cursor: pointer; }

.td-id {
  font-weight: 600;
  color: var(--accent);
}

.td-muted {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* ── Activity feed ──────────────────────────── */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.green { background: var(--green); }
.activity-dot.blue  { background: var(--accent); }
.activity-dot.yellow { background: var(--yellow); }

.activity-text {
  font-size: 14px;
  color: var(--text);
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Empty state ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 14px;
}

/* ── Login page ─────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f7f8fb 0%, #eef1f7 100%);
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  margin-bottom: 8px;
}

.login-logo img {
  height: 40px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
}

.login-btn:hover {
  background: var(--surface-hover);
  border-color: #ccc;
}

.login-btn svg, .login-btn img {
  width: 20px;
  height: 20px;
}

.login-input-group {
  margin-top: 16px;
}

.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.login-magic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  margin-top: 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: #ffffff;
  transition: background 0.15s;
}

.login-magic-btn:hover {
  background: var(--accent-hover);
}

.login-footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Detail page ────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.detail-meta dt {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.detail-meta dd {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
}

/* ── Status timeline ────────────────────────── */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid #ffffff;
}

.timeline-dot.active {
  background: var(--accent);
}

.timeline-dot.completed {
  background: var(--green);
}

.timeline-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ── Line items table ───────────────────────── */
.line-items th { font-size: 12px; }
.line-items td { font-size: 13px; }
.line-items .text-right { text-align: right; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1024px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
    padding: 20px 16px;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .login-card {
    margin: 16px;
    padding: 32px 24px;
  }
}
