/* ============================================
   DROPPING TRACKING - Design System
   Dark Premium Theme with Glassmorphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: rgba(30, 41, 59, 0.8);
  --bg-glass: rgba(255,255,255,0.05);
  --bg-input: rgba(15, 23, 42, 0.6);
  --border-color: rgba(255,255,255,0.08);
  --border-focus: #10B981;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --emerald: #10B981;
  --emerald-dark: #059669;
  --emerald-glow: rgba(16,185,129,0.15);
  --amber: #F59E0B;
  --amber-dark: #D97706;
  --purple: #8B5CF6;
  --purple-dark: #7C3AED;
  --red: #EF4444;
  --red-dark: #DC2626;
  --blue: #3B82F6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(16,185,129,0.2);
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--emerald); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--emerald-dark); }

img { max-width: 100%; height: auto; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-purple { color: var(--purple); }
.text-red { color: var(--red); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.fw-semi { font-weight: 600; }
.small { font-size: 0.85rem; }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.w-full { width: 100%; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.hidden { display: none !important; }

/* --- Glass Card --- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.12); }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border-color); }

/* --- Navbar --- */
.navbar {
  background: rgba(15,23,42,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  position: sticky; top: 0; z-index: 100;
}
.navbar-brand {
  font-weight: 800; font-size: 1.2rem;
  background: linear-gradient(135deg, var(--emerald), var(--blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar-info { font-size: 0.8rem; color: var(--text-secondary); }
.navbar-info .badge { margin-left: 0.5rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-family: var(--font); font-size: 0.9rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff; box-shadow: 0 2px 10px rgba(16,185,129,0.3);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(16,185,129,0.4); filter: brightness(1.1); }

.btn-amber {
  background: linear-gradient(135deg, var(--amber), var(--amber-dark));
  color: #fff;
}
.btn-purple {
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  color: #fff;
}
.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--emerald); color: var(--emerald); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* --- Form Controls --- */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; margin-bottom: 0.35rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
}
.form-control, .form-select {
  width: 100%; padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font); font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.form-control:focus, .form-select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-secondary); color: var(--text-primary); }
textarea.form-control { min-height: 80px; resize: vertical; }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; font-size: 0.7rem; font-weight: 700;
  border-radius: 999px; letter-spacing: 0.03em;
}
.badge-emerald { background: var(--emerald-glow); color: var(--emerald); }
.badge-amber { background: rgba(245,158,11,0.15); color: var(--amber); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-blue { background: rgba(59,130,246,0.15); color: var(--blue); }

/* --- Table --- */
.table-wrapper {
  overflow-x: auto; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
thead th {
  background: rgba(16,185,129,0.08);
  padding: 0.75rem 0.8rem;
  text-align: left; font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--emerald); white-space: nowrap;
  border-bottom: 2px solid rgba(16,185,129,0.2);
}
tbody td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}
tbody tr { transition: var(--transition); }
tbody tr:hover { background: rgba(16,185,129,0.04); }
tbody tr:last-child td { border-bottom: none; }

/* DataTables overrides */
.dataTables_wrapper { color: var(--text-secondary); font-size: 0.85rem; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--bg-input); border: 1px solid var(--border-color);
  color: var(--text-primary); border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--bg-glass) !important;
  margin: 0 2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--emerald) !important;
  color: #fff !important;
  border-color: var(--emerald) !important;
}

/* --- Tabs --- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-color); margin-bottom: 1.5rem; overflow-x: auto; }
.tab-btn {
  padding: 0.7rem 1.25rem; font-family: var(--font);
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: var(--transition); white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--emerald); border-bottom-color: var(--emerald); }
.tab-pane { display: none; animation: fadeIn 0.3s ease; }
.tab-pane.active { display: block; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; opacity: 0; visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-glass); border: 1px solid var(--border-color);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; transition: var(--transition);
}
.modal-close:hover { background: var(--red); color: #fff; border-color: var(--red); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex; gap: 0.5rem; justify-content: flex-end;
}

/* --- Toast --- */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  padding: 0.8rem 1.2rem; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.5s forwards;
  max-width: 360px;
}
.toast-success { background: var(--emerald-dark); color: #fff; }
.toast-error { background: var(--red-dark); color: #fff; }
.toast-warning { background: var(--amber-dark); color: #fff; }
.toast-info { background: var(--blue); color: #fff; }

/* --- Progress Bar --- */
.progress-bar {
  height: 6px; background: var(--bg-glass);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--emerald), var(--blue));
  transition: width 0.4s ease;
}

/* --- Upload Slot --- */
.upload-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.upload-slot {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem; text-align: center;
  cursor: pointer; transition: var(--transition);
  position: relative; min-height: 140px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.5rem;
}
.upload-slot:hover { border-color: var(--emerald); background: var(--emerald-glow); }
.upload-slot.has-file { border-color: var(--emerald); border-style: solid; }
.upload-slot .upload-icon { font-size: 2rem; opacity: 0.5; }
.upload-slot .upload-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.upload-slot .preview-img {
  width: 100%; height: 100px; object-fit: cover;
  border-radius: var(--radius-sm);
}
.upload-slot .remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--red); color: #fff; border: none;
  font-size: 0.7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.filter-bar .form-control,
.filter-bar .form-select { padding: 0.5rem 0.7rem; font-size: 0.85rem; }

/* --- Stats Cards --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem; position: relative;
  overflow: hidden; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--emerald), var(--blue));
}
.stat-card.ayam::before { background: linear-gradient(90deg, var(--amber), #F97316); }
.stat-card.domba::before { background: linear-gradient(90deg, var(--purple), #A855F7); }
.stat-value { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-glass) 25%, rgba(255,255,255,0.08) 50%, var(--bg-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 100px; }

/* --- Login Page --- */
.login-wrapper {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0F172A 0%, #1a1a3e 50%, #0F172A 100%);
  position: relative; overflow: hidden;
}
.login-wrapper::before {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(16,185,129,0.15), transparent 70%);
  top: -100px; right: -100px; border-radius: 50%;
}
.login-wrapper::after {
  content: ''; position: absolute; width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,0.1), transparent 70%);
  bottom: -80px; left: -80px; border-radius: 50%;
}
.login-card {
  max-width: 420px; width: 100%; position: relative; z-index: 1;
}
.login-card .card-header {
  text-align: center; padding: 2rem 1.5rem;
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(139,92,246,0.05));
}
.login-card .card-header h2 {
  background: linear-gradient(135deg, var(--emerald), var(--blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 0.25rem;
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse { animation: pulse 2s infinite; }
.animate-fadeIn { animation: fadeIn 0.3s ease; }

/* --- Responsive --- */
@media (max-width: 768px) {
  html { font-size: 14px; }
  .container { padding: 0 0.75rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  .navbar { padding: 0.6rem 1rem; }
  .card-body { padding: 1rem; }
  .tabs { gap: 0; }
  .tab-btn { padding: 0.6rem 0.8rem; font-size: 0.78rem; }
  .modal { margin: 0.5rem; max-height: 95vh; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
}
