:root {
  --tarzan-red: #B40000;
  --tarzan-red-hover: #900000;
  --tarzan-red-light: #FFF0F0;
  --polish-blue: #1E3A8A;
  --polish-blue-light: #EFF6FF;
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;
  --success-green: #16A34A;
  --warning-amber: #D97706;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--slate-50);
  color: var(--slate-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header Bar */
.app-header {
  background: linear-gradient(135deg, var(--tarzan-red) 0%, #700000 100%);
  color: #FFFFFF;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(180, 0, 0, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.78rem;
  opacity: 0.9;
  font-weight: 400;
}

.user-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
}

/* Container & Layout */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  flex: 1;
  padding-bottom: 90px;
}

/* Cards & UI Elements */
.card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--slate-200);
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stats Summary Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #FFFFFF;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid var(--slate-200);
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1;
}

.stat-lbl {
  font-size: 0.78rem;
  color: var(--slate-600);
  margin-top: 4px;
  font-weight: 500;
}

/* Admin Tab Bar */
.admin-tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1.5px solid var(--slate-200);
  background: #FFFFFF;
  color: var(--slate-700);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--tarzan-red);
  color: #FFFFFF;
  border-color: var(--tarzan-red);
  box-shadow: 0 4px 10px rgba(180, 0, 0, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--tarzan-red);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--tarzan-red-hover);
}

.btn-secondary {
  background-color: var(--polish-blue);
  color: #FFFFFF;
}

.btn-success {
  background-color: var(--success-green);
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--slate-200);
  color: var(--slate-700);
}

.btn-outline:hover {
  background-color: var(--slate-100);
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--slate-200);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #FFFFFF;
  color: var(--slate-900);
}

.form-control:focus {
  border-color: var(--tarzan-red);
  box-shadow: 0 0 0 3px rgba(180, 0, 0, 0.1);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Filter Controls Row */
.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

/* Camera Preview Box */
.camera-box {
  width: 100%;
  max-width: 380px;
  aspect-ratio: 4 / 3;
  height: auto;
  min-height: 280px;
  background: #000000;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 auto 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 2px solid var(--slate-800);
}

.camera-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  background-color: #000000;
}

.camera-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-color: #000000;
}

.face-oval-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 180px;
  border: 2.5px dashed rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

.camera-instruction-tag {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  pointer-events: none;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--slate-200);
  max-height: 600px;
  overflow-y: auto;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #FFFFFF;
  text-align: left;
  font-size: 0.88rem;
}

th {
  background-color: var(--slate-900);
  color: #FFFFFF;
  padding: 12px 14px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

tr:nth-child(even) {
  background-color: #FAFAFA;
}

tr:hover {
  background-color: #F1F5F9;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-content {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

/* Utility Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: #DCFCE7; color: #166534; }
.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-info { background: #DBEAFE; color: #1E40AF; }

.hidden { display: none !important; }

/* Responsive Media Queries */
@media (max-width: 640px) {
  .container {
    padding: 12px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row .btn, .filter-row .form-control {
    width: 100% !important;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-content {
    padding: 18px;
  }
}

