/* ═══════════════════════════════════════════════
   Resume Portal — Iteration 2 Styles
   Gate · Resume · Chat Widget · Admin · Print
   ═══════════════════════════════════════════════ */

/* ── Reset & Variables ─────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root, [data-theme="light"] {
  /* Resume colors */
  --color-text:        #1a1a2e;
  --color-text-muted:  #475569;
  --color-accent:      #2563eb;
  --color-accent-light:#3b82f6;
  --color-border:      #cbd5e1;
  --color-border-light:#e2e8f0;
  --color-bg:          #f8fafc;
  --color-card-bg:     #ffffff;
  --color-toolbar-bg:  #ffffff;
  --color-sidebar-bg:  #f8fafc;
  --color-tag-bg:      #f1f5f9;
  --color-tag-text:    #334155;
  --color-shadow:      0 4px 20px rgba(0, 0, 0, 0.08);

  /* Theme Toggle Button */
  --color-toggle-bg:   #f1f5f9;
  --color-toggle-hover:#e2e8f0;
  --color-toggle-text: #1e293b;
  --color-toggle-border: #cbd5e1;

  /* Gate colors */
  --gate-bg:           #0f172a;
  --gate-card:         rgba(30, 41, 59, 0.75);
  --gate-border:       rgba(59, 130, 246, 0.25);
  --gate-text:         #e2e8f0;
  --gate-muted:        #94a3b8;
  --gate-accent:       #3b82f6;

  /* Admin colors */
  --admin-bg:          #f1f5f9;
  --admin-card-bg:     #ffffff;
  --admin-topbar-bg:   #ffffff;
  --admin-sidebar-bg:  #334155;
  --admin-text:        #0f172a;
  --admin-text-muted:  #64748b;
  --admin-border:      #e2e8f0;
  --admin-input-bg:    #ffffff;
  --admin-table-header-bg: #f8fafc;
  --admin-table-hover-bg: #f8fafc;

  /* Chat widget */
  --chat-bg:           #ffffff;
  --chat-header-bg:    #2563eb;
  --chat-bubble-user:  #2563eb;
  --chat-bubble-agent: #f1f5f9;
  --chat-text-agent:   #1a1a2e;
  --chat-input-bg:     #ffffff;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  /* Resume colors */
  --color-text:        #f1f5f9;
  --color-text-muted:  #94a3b8;
  --color-accent:      #60a5fa;
  --color-accent-light:#93c5fd;
  --color-border:      #334155;
  --color-border-light:#1e293b;
  --color-bg:          #0b0f19;
  --color-card-bg:     #111827;
  --color-toolbar-bg:  #111827;
  --color-sidebar-bg:  #1e293b;
  --color-tag-bg:      #1e293b;
  --color-tag-text:    #cbd5e1;
  --color-shadow:      0 4px 20px rgba(0, 0, 0, 0.45);

  /* Theme Toggle Button */
  --color-toggle-bg:   #1e293b;
  --color-toggle-hover:#334155;
  --color-toggle-text: #f1f5f9;
  --color-toggle-border: #334155;

  /* Gate colors */
  --gate-bg:           #090d16;
  --gate-card:         rgba(17, 24, 39, 0.85);
  --gate-border:       rgba(96, 165, 250, 0.25);
  --gate-text:         #f1f5f9;
  --gate-muted:        #94a3b8;
  --gate-accent:       #60a5fa;

  /* Admin colors */
  --admin-bg:          #0b0f19;
  --admin-card-bg:     #111827;
  --admin-topbar-bg:   #111827;
  --admin-sidebar-bg:  #1e293b;
  --admin-text:        #f1f5f9;
  --admin-text-muted:  #94a3b8;
  --admin-border:      #1e293b;
  --admin-input-bg:    #1f2937;
  --admin-table-header-bg: #1f2937;
  --admin-table-hover-bg: #1f2937;

  /* Chat widget */
  --chat-bg:           #111827;
  --chat-header-bg:    #1e3a8a;
  --chat-bubble-user:  #2563eb;
  --chat-bubble-agent: #1e293b;
  --chat-text-agent:   #f1f5f9;
  --chat-input-bg:     #1f2937;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 13.2px; }

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; }

/* ═══════════════════════════════════════════════
   GATE PAGE
   ═══════════════════════════════════════════════ */
.gate {
  position: fixed;
  inset: 0;
  background: var(--gate-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}

/* Floating background orbs */
.gate-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
}

.gate-bg-orb-1 {
  width: 400px; height: 400px;
  background: #3b82f6;
  top: -100px; right: -100px;
  animation: float-orb 12s ease-in-out infinite;
}

.gate-bg-orb-2 {
  width: 300px; height: 300px;
  background: #8b5cf6;
  bottom: -80px; left: -80px;
  animation: float-orb 10s ease-in-out infinite reverse;
}

.gate-bg-orb-3 {
  width: 200px; height: 200px;
  background: #06b6d4;
  top: 40%; left: 60%;
  animation: float-orb 14s ease-in-out infinite 2s;
}

@keyframes float-orb {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(30px, -20px); }
  66% { transform: translate(-20px, 30px); }
}

/* Card */
.gate-card {
  position: relative;
  z-index: 1;
  background: var(--gate-card);
  border: 1px solid var(--gate-border);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  animation: card-appear 0.5s ease-out;
}

@keyframes card-appear {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--gate-accent);
  margin-bottom: 1.5rem;
}

.gate-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gate-text);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.gate-subtitle {
  font-size: 0.95rem;
  color: var(--gate-muted);
  margin-bottom: 2rem;
}

/* Form */
.gate-form {
  margin-bottom: 1.5rem;
}

.gate-input-wrapper {
  display: flex;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--gate-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input-wrapper:focus-within {
  border-color: var(--gate-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.gate-input {
  flex: 1;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: none;
  color: var(--gate-text);
  font-size: 1rem;
  font-family: var(--font-main);
  outline: none;
}

.gate-input::placeholder {
  color: var(--gate-muted);
}

.gate-submit {
  padding: 0.85rem 1.2rem;
  background: var(--gate-accent);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.gate-submit:hover {
  background: #2563eb;
}

.gate-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gate-error {
  color: #f87171;
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

.gate-footer {
  font-size: 0.82rem;
  color: var(--gate-muted);
}

.gate-footer a {
  color: var(--gate-accent);
}

/* Loading spinner */
.gate-loading .gate-submit svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--gate-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--gate-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  margin-top: 1rem;
  color: var(--gate-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════
   RESUME CONTAINER
   ═══════════════════════════════════════════════ */
.resume-container {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.resume-container.visible {
  opacity: 1;
}

/* Resume footer */
.resume-footer {
  text-align: center;
  padding: 0.15in 0 0.1in;
  margin-top: 0.1in;
  border-top: 1px solid var(--color-border-light);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  opacity: 0.6;
  font-style: italic;
}

/* Toolbar */
.resume-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-toolbar-bg);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-main);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s ease;
}

.toolbar-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* ── Theme Toggle Button ─────────────────────────── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--color-toggle-bg);
  color: var(--color-toggle-text);
  border: 1px solid var(--color-toggle-border);
  border-radius: 8px;
  font-size: 0.84rem;
  font-family: var(--font-main);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.15s ease;
  user-select: none;
}

.theme-toggle-btn:hover {
  background: var(--color-toggle-hover);
  border-color: var(--color-accent);
  transform: translateY(-1px);
}

.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover svg {
  transform: rotate(20deg) scale(1.1);
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Gate Theme Toggle Positioning */
.gate-theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1002;
}

.gate-theme-toggle .theme-toggle-btn {
  background: rgba(30, 41, 59, 0.7);
  border-color: var(--gate-border);
  color: var(--gate-text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gate-theme-toggle .theme-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--gate-accent);
  color: white;
}

/* ═══════════════════════════════════════════════
   RESUME PAGE
   ═══════════════════════════════════════════════ */
.page {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 2.5rem 3rem 2rem;
  background: var(--color-card-bg);
  border-radius: 12px;
  box-shadow: var(--color-shadow);
  transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.shadow {
  box-shadow: var(--color-shadow);
}

/* ── Header ──────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.18in;
  padding-bottom: 0.13in;
  border-bottom: 2.5px solid var(--color-accent);
}

.header-left h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.header-left .title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-accent);
  margin-top: 0.03in;
}

.header-right {
  text-align: right;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.header-right a {
  color: var(--color-text-muted);
}

/* ── Two-Column Layout ───────────────────────────── */
.content {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0 2.5rem;
}

/* ── Section ─────────────────────────────────────── */
.section {
  margin-bottom: 0.16in;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-accent);
  border-bottom: 1.5px solid var(--color-border-light);
  padding-bottom: 0.03in;
  margin-bottom: 0.08in;
}

/* ── Professional Summary ────────────────────────── */
.summary {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.16in;
}

/* ── Experience ───────────────────────────────────── */
.job {
  margin-bottom: 0.13in;
}

.job:last-child { margin-bottom: 0; }

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

.job-company {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

.job-location {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.job-role-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 0.04in;
}

.job-role {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-accent);
  font-style: italic;
}

.job-dates {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.promotion {
  font-size: 0.74rem;
  color: var(--color-accent-light);
  font-weight: 500;
  font-style: italic;
  margin-bottom: 0.04in;
}

.job-bullets ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.job-bullets li {
  list-style-type: none;
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.45;
  padding-left: 0.16in;
  position: relative;
  margin-bottom: 0.025in;
}

.job-bullets li::before {
  content: '\25b8';
  position: absolute;
  left: 0;
  color: var(--color-accent-light);
  font-size: 0.7rem;
  top: 0.01in;
}

.job-desc {
  font-size: 0.83rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ── Projects ─────────────────────────────────────── */
.project {
  margin-bottom: 0.08in;
}

.project:last-child { margin-bottom: 0; }

.project-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-text);
}

.project-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar .section {
  margin-bottom: 0.15in;
}

.sidebar-list {
  list-style: none;
  padding: 0;
}

.sidebar-list li {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.02in;
}

.sidebar-tags {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* ── Certifications ──────────────────────────────── */
.cert-entry {
  margin-bottom: 0.04in;
}

.cert-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.cert-date {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.cert-status {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--color-accent-light);
}

/* ── Education ────────────────────────────────────── */
.edu-entry {
  margin-bottom: 0.06in;
}

.edu-school {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

.edu-degree {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.edu-details {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

/* ═══════════════════════════════════════════════
   CHAT WIDGET — "Plan a Call"
   ═══════════════════════════════════════════════ */
.chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.chat-fab:hover {
  transform: translateY(-2px);
  background: var(--color-accent-light, #2563eb);
  box-shadow: 0 10px 25px rgba(30, 64, 175, 0.45), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.chat-fab:active {
  transform: translateY(0);
}

.chat-fab svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chat-badge {
  display: inline;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.chat-drawer {
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 500px;
  max-height: calc(100vh - 4rem);
  background: var(--chat-bg);
  color: var(--color-text);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border-light);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  animation: chatSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-header {
  background: var(--chat-header-bg);
  color: #ffffff;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.chat-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--color-bg);
}

.chat-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-msg.assistant {
  background: var(--chat-bubble-agent);
  border: 1px solid var(--color-border-light);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: var(--chat-text-agent);
}

.chat-msg.user {
  background: var(--chat-bubble-user);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  display: flex;
  padding: 0.85rem 1rem;
  background: var(--chat-bg);
  border-top: 1px solid var(--color-border-light);
  gap: 0.5rem;
  align-items: center;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 0.6rem 1rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  background: var(--chat-input-bg);
  color: var(--color-text);
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: var(--color-accent);
}

.chat-send {
  background: var(--color-accent);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.chat-send:hover:not(:disabled) {
  background: var(--color-accent-light, #2563eb);
  transform: scale(1);
}

.chat-send:disabled {
  background: var(--color-border-light);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.85rem 1rem !important;
  align-items: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ═══════════════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════════════ */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.admin-header {
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--admin-text);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-text-muted);
  margin-bottom: 0.3rem;
}

.kpi-card .kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--admin-text);
}

.kpi-card .kpi-sub {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
  margin-top: 0.15rem;
}

.admin-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.admin-filters select,
.admin-filters input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-main);
  background: var(--admin-input-bg);
  color: var(--admin-text);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  background: var(--admin-table-header-bg);
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--admin-text);
  border-bottom: 2px solid var(--admin-border);
}

.admin-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text-muted);
}

.admin-table tr:hover td {
  background: var(--admin-table-hover-bg);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: var(--font-main);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
  padding: 0.55rem 1.1rem;
  font-size: 1rem;
}

.btn-primary:hover {
  background: #3b82f6;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE SCREEN STYLES
   ═══════════════════════════════════════════════ */

/* Tablet */
@media screen and (max-width: 1023px) and (min-width: 768px) {
  .page {
    padding: 2rem 2rem;
  }

  .content {
    grid-template-columns: 1fr 220px;
    gap: 0 1.5rem;
  }

  .chat-drawer {
    width: 340px;
  }
}

/* Mobile */
@media screen and (max-width: 767px) {
  .page {
    padding: 1.5rem 1rem;
  }

  .header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .header-right {
    text-align: left;
  }

  .content {
    grid-template-columns: 1fr;
    gap: 1.5rem 0;
  }

  .header-left h1 {
    font-size: 1.4rem;
  }

  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .chat-widget.open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .chat-drawer {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }

  .chat-fab {
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 480px) {
  .page {
    padding: 1rem 0.75rem;
  }

  .header-left h1 {
    font-size: 1.25rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════
   BLAZOR ERROR UI
   ═══════════════════════════════════════════════ */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: black;
}

[data-theme="dark"] #blazor-error-ui {
    background: #4b0000;
    color: white;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

textarea {
    font-size: 1rem;
}/* --- Admin Global Layout & Variables --- */
.admin-wrapper { display: flex; height: 100vh; background: var(--admin-bg); color: var(--admin-text); font-family: var(--font-main); }
.admin-sidebar { width: 250px; background: var(--admin-sidebar-bg); color: white; display: flex; flex-direction: column; transition: width 0.3s ease; }
.admin-sidebar.collapsed { width: 68px; }
.admin-brand { padding: 1.5rem; font-size: 1.25rem; font-weight: 700; border-bottom: 1px solid var(--admin-border); white-space: nowrap; overflow: hidden; text-align: left; }
.admin-sidebar.collapsed .admin-brand { text-align: center; padding: 1.5rem 0; }
.admin-nav { list-style: none; padding: 1rem 0; margin: 0; }
.admin-nav li a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem; color: #94a3b8; text-decoration: none; transition: background 0.2s, color 0.2s, padding 0.3s ease, justify-content 0.3s ease; white-space: nowrap; overflow: hidden; }
.admin-sidebar.collapsed .admin-nav li a { justify-content: center; padding: 0.75rem; }
.admin-sidebar.collapsed .nav-text { display: none; }
.admin-nav li a svg { flex-shrink: 0; }
.admin-nav li a:hover, .admin-nav li a.active { background: #334155; color: white; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--admin-border); margin-top: auto; }
.toggle-btn { width: 100%; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: transparent; color: #94a3b8; border: none; cursor: pointer; transition: background 0.2s, color 0.2s; border-radius: 6px; white-space: nowrap; overflow: hidden; }
.toggle-btn:hover { background: #334155; color: white; }
.admin-sidebar.collapsed .toggle-btn { justify-content: center; }
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; background: var(--admin-topbar-bg); padding: 1rem 2rem; border-bottom: 1px solid var(--admin-border); }
.admin-topbar h2 { margin: 0; font-size: 1.25rem; color: var(--admin-text); }
.admin-content { flex: 1; overflow-y: auto; padding: 2rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-header h3 { margin: 0; color: var(--admin-text); }

/* --- Admin Cards & Forms --- */
.card { background: var(--admin-card-bg); color: var(--admin-text); border: 1px solid var(--admin-border); border-radius: 8px; box-shadow: var(--color-shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.inline-form { background: var(--admin-card-bg); padding: 1.5rem; border-radius: 8px; margin-bottom: 1.5rem; border: 1px solid var(--admin-border); box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05); }
.form-row { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 200px; margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; }
.form-control { width: 100%; padding: 0.5rem; border: 1px solid var(--admin-border); border-radius: 4px; background: var(--admin-bg); color: var(--admin-text); font-family: inherit; }

/* --- Admin Tables --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--admin-border); }
th { font-weight: 600; color: var(--admin-text-muted); font-size: 0.85rem; text-transform: uppercase; background: var(--admin-table-header-bg); }
td { color: var(--admin-text-muted); }
  td button { margin-right: 0.25rem; font-size: 0.75rem; padding: 0.25rem 0.5rem; }
  .action-buttons { white-space: nowrap; width: 1%; }

/* --- Dashboard & Metrics --- */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.metric-card { text-align: center; padding: 2rem; }
.metric-title { color: #64748b; font-size: 0.875rem; font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
.metric-value { font-size: 2.5rem; font-weight: 700; color: #0f172a; }

/* --- Admin Tabs --- */
.tabs-container { margin-bottom: 1.5rem; }
.tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--admin-border); padding-bottom: 0.5rem; overflow-x: auto; }
.tab-btn { background: none; border: none; padding: 0.5rem 1rem; cursor: pointer; font-weight: 500; color: var(--admin-text-muted); border-radius: 6px; }
.tab-btn:hover { background: var(--admin-card-bg); }
.tab-btn.active { background: var(--admin-card-bg); color: var(--admin-text); box-shadow: var(--color-shadow); }

/* --- Admin Badges & Alerts --- */
.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #e0f2fe; color: #0369a1; }
.badge.warning { background: #fef3c7; color: #92400e; }
.alert-danger { color: #842029; background-color: #f8d7da; border: 1px solid #f5c2c7; padding: 1rem; border-radius: 0.25rem; margin-bottom: 1rem; }

/* --- Admin Buttons --- */
.btn-outline, .btn-outline-primary, .btn-outline-danger, .btn-outline-secondary, .btn-outline-warning, .btn-outline-success { background: transparent; padding: 0.25rem 0.5rem; border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 0.875rem;}
.btn-outline { color: var(--admin-text); border: 1px solid var(--admin-border); }
.btn-outline:hover { background: var(--admin-border); color: var(--admin-text); }
.btn-outline-primary { color: #1e3a8a; border: 1px solid #1e3a8a; }
.btn-outline-primary:hover { background: #1e3a8a; color: white; }
.btn-outline-danger { color: #ef4444; border: 1px solid #ef4444; }
.btn-outline-danger:hover { background: #ef4444; color: white; }
.btn-outline-secondary { color: #64748b; border: 1px solid #64748b; }
.btn-outline-secondary:hover { background: #64748b; color: white; }
.btn-outline-warning { color: #f59e0b; border: 1px solid #f59e0b; }
.btn-outline-warning:hover { background: #f59e0b; color: white; }
.btn-outline-success { color: #10b981; border: 1px solid #10b981; }
.btn-outline-success:hover { background: #10b981; color: white; }
.icon-btn { background: transparent; border: none; color: var(--admin-text); cursor: pointer; padding: 0.2rem 0.4rem; font-size: 1.2rem; transition: color 0.2s; line-height: 1; }
.icon-btn:hover { color: var(--admin-primary); }
.icon-btn:disabled { color: var(--admin-text-muted); cursor: not-allowed; }

/* --- Admin Drag & Drop --- */
.section-card { margin-bottom: 1rem; padding: 1.25rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--admin-border); padding-bottom: 0.5rem; }
.section-header h4 { margin: 0; color: var(--admin-text); }
.section-list { display: flex; flex-direction: column; gap: 0.5rem; }
.section-list-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--admin-bg); border: 1px solid var(--admin-border); border-radius: 6px; }
.dragging { opacity: 0.5; background-color: var(--admin-bg) !important; }
.drag-over { border-top: 2px solid var(--admin-primary) !important; background-color: var(--admin-bg) !important; }


  
  /* --- Validation --- */
  label.required::after {
      content: ' *';
      color: #ef4444;
  }
  .form-control.is-invalid {
      border-color: #ef4444 !important;
  }
