/* ============================================
 NATHAN LOGISTICS — SETUP PORTAL STYLES
============================================ */

:root {
  --brand: #DC2626;
  --brand-dark: #991B1B;
  --brand-light: #FEF2F2;
  --accent: #EA580C;
  --agent-brand: #2563EB;
  --agent-light: #EFF6FF;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #F3F4F6;
  margin: 0;
  padding: 0;
  color: #111827;
}

a { color: inherit; text-decoration: none; }

/* ===== Utility Classes ===== */
.brand-bg { background: var(--brand); }
.brand-text { color: var(--brand); }
.brand-border { border-color: var(--brand); }
.agent-bg { background: var(--agent-brand); }
.agent-text { color: var(--agent-brand); }

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #E5E7EB;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.sidebar-logo.agent { background: var(--agent-brand); }

.sidebar-nav {
  flex: 1;
  padding: 12px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: #4B5563;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.sidebar-item:hover { background: #F3F4F6; }

.sidebar-item.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}

.sidebar-item.active.agent-mode {
  background: var(--agent-light);
  color: var(--agent-brand);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #E5E7EB;
}

/* ===== Main Content ===== */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.page-header .subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 2px 0 0;
}

.page-body {
  padding: 32px;
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-progress { background: #DBEAFE; color: #1E40AF; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #E0F2FE; color: #075985; }

/* ===== Stat Cards ===== */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #E5E7EB;
}

.stat-card .label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: bold;
  color: #111827;
}

/* ===== Tables ===== */
.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  background: #F9FAFB;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tbl td {
  padding: 12px;
  font-size: 14px;
  color: #111827;
  border-top: 1px solid #F3F4F6;
}

.tbl tr:hover td { background: #FAFAFA; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
  border: none;
  text-decoration: none;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-agent { background: var(--agent-brand); color: #fff; }
.btn-agent:hover { background: #1D4ED8; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #D1D5DB; }
.btn-outline:hover { background: #F9FAFB; }
.btn-success { background: #10B981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== Forms ===== */
.input, .form-control, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: #fff;
}

.input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.agent-mode .input:focus {
  border-color: var(--agent-brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 6px;
}

/* ===== Cards ===== */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2, .card-header h3 {
  margin: 0;
  font-weight: 600;
  color: #111827;
}

.card-body { padding: 20px; }

/* ===== Progress Bar ===== */
.progress {
  height: 6px;
  background: #F3F4F6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--brand);
  transition: width 0.3s;
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid #10B981; }
.alert-danger { background: #FEE2E2; color: #991B1B; border-left: 4px solid #EF4444; }
.alert-info { background: #DBEAFE; color: #1E40AF; border-left: 4px solid #3B82F6; }
.alert-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid #F59E0B; }

/* ===== Chat ===== */
.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  margin-bottom: 10px;
  word-wrap: break-word;
}

.chat-me {
  background: var(--brand);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-me.agent { background: var(--agent-brand); }

.chat-them {
  background: #F3F4F6;
  color: #111827;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

/* ===== Utility ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 14px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Grid Helpers ===== */
.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }

/* ===== Login Pages ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.login-admin-bg { background: linear-gradient(135deg, #FEF2F2 0%, #FFF7ED 100%); }
.login-agent-bg { background: linear-gradient(135deg, #DBEAFE 0%, #EEF2FF 100%); }

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.hidden { display: none; }

/* OTP Input */
.otp-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.otp-digit {
  width: 48px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  outline: none;
}

.otp-digit:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Upload area */
.upload-zone {
  background: #fff;
  border: 2px dashed #D1D5DB;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
}

.upload-zone:hover { border-color: var(--brand); background: #FEFEFE; }
