/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6fa;
  color: #2d3436;
  line-height: 1.6;
}

/* ─── Login Screen ──────────────────────────────────────────────────────────── */
.login-card {
  max-width: 380px;
  margin: 120px auto;
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}

.login-card h1 {
  font-size: 28px;
  color: #1a237e;
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: #636e72;
  margin-bottom: 32px;
  font-size: 14px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #636e72;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  font-size: 15px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #1a237e;
  box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.error-text {
  color: #c0392b;
  font-size: 13px;
  margin-top: 12px;
}

.btn-microsoft {
  background: #2f2f2f;
  color: white;
  border-color: #2f2f2f;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.btn-microsoft:hover { background: #404040; color: white; }

.btn-microsoft svg {
  vertical-align: middle;
  margin-right: 4px;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: #b2bec3;
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #dfe6e9;
}

.auth-divider span {
  padding: 0 12px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  background: white;
  color: #2d3436;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover { background: #f5f6fa; }

.btn-primary {
  background: #1a237e;
  color: white;
  border-color: #1a237e;
}

.btn-primary:hover { background: #283593; }
.btn-primary:disabled { background: #9fa8da; border-color: #9fa8da; cursor: not-allowed; }

.btn-full { width: 100%; justify-content: center; }
.btn-small { padding: 4px 12px; font-size: 13px; }
.btn-large { padding: 12px 32px; font-size: 16px; }

.btn-download {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #a5d6a7;
  font-size: 12px;
  padding: 4px 10px;
}

.btn-download:hover { background: #c8e6c9; }

/* ─── Header ────────────────────────────────────────────────────────────────── */
.header {
  background: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dfe6e9;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header h1 {
  font-size: 20px;
  color: #1a237e;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#user-display {
  font-size: 14px;
  color: #636e72;
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1000px;
  margin: 32px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.card h2 {
  font-size: 18px;
  color: #2d3436;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h2 { margin-bottom: 0; }

/* ─── Order Counts ──────────────────────────────────────────────────────────── */
.order-counts {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.count-box {
  flex: 1;
  background: #f5f6fa;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.count-box .count {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #1a237e;
}

.count-box .count-label {
  font-size: 13px;
  color: #636e72;
  font-weight: 500;
}

/* ─── Data Tables ───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #636e72;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #dfe6e9;
}

.data-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:hover {
  background: #fafbfc;
}

.data-table .loading {
  text-align: center;
  color: #b2bec3;
  padding: 24px;
}

/* ─── Status Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-new { background: #e3f2fd; color: #1565c0; }
.badge-processing { background: #fff3e0; color: #e65100; }
.badge-pre-transit { background: #e8f5e9; color: #2e7d32; }
.badge-in-transit { background: #f3e5f5; color: #7b1fa2; }
.badge-yes { background: #e8f5e9; color: #2e7d32; }
.badge-no { background: #fce4ec; color: #c62828; }

/* ─── Action Card ───────────────────────────────────────────────────────────── */
.action-card {
  border: 2px solid #e8eaf6;
  background: linear-gradient(135deg, #fff, #f5f6fa);
}

.action-card p {
  color: #636e72;
  margin-bottom: 20px;
  font-size: 14px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ─── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #dfe6e9;
  border-top-color: #1a237e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#processing-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #636e72;
  font-size: 14px;
}

/* ─── Batch Result ──────────────────────────────────────────────────────────── */
.batch-result {
  margin-top: 20px;
  padding: 16px;
  background: #e8f5e9;
  border-radius: 8px;
  border: 1px solid #a5d6a7;
}

.batch-result h3 {
  color: #2e7d32;
  font-size: 16px;
  margin-bottom: 8px;
}

.batch-result p {
  color: #2d3436;
  margin-bottom: 4px;
}

.batch-result .download-links {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Navigation ────────────────────────────────────────────────────────────── */
.btn-nav {
  background: transparent;
  border: none;
  color: #636e72;
  font-weight: 500;
}

.btn-nav:hover { background: #f5f6fa; color: #2d3436; }
.btn-nav.active { color: #1a237e; font-weight: 600; }

.nav-separator {
  color: #dfe6e9;
  font-size: 14px;
}

/* ─── Admin: Add User Form ──────────────────────────────────────────────────── */
.section-desc {
  color: #636e72;
  font-size: 14px;
  margin-bottom: 20px;
}

.add-user-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input-field {
  padding: 8px 12px;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.input-field:focus {
  outline: none;
  border-color: #1a237e;
  box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.input-field[type="email"] { flex: 1; min-width: 200px; }
.input-field[type="text"] { flex: 0.7; min-width: 150px; }
.select-field { min-width: 120px; }

/* ─── Admin: User Actions ───────────────────────────────────────────────────── */
.btn-danger {
  background: #fce4ec;
  color: #c62828;
  border-color: #ef9a9a;
  font-size: 12px;
  padding: 4px 10px;
}

.btn-danger:hover { background: #ffcdd2; }

.btn-toggle {
  font-size: 12px;
  padding: 4px 10px;
}

.role-select {
  padding: 4px 8px;
  border: 1px solid #dfe6e9;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}

.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #fce4ec; color: #c62828; }

.user-actions {
  display: flex;
  gap: 6px;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .order-counts { flex-wrap: wrap; }
  .count-box { min-width: 45%; }
  .header { padding: 12px 16px; }
  .main-content { padding: 0 12px; }
}
