/**
 * BroilerPro Design System
 * Unified, structured CSS for Modern Broiler Farm Management
 */

:root {
  --bp-font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --bp-font-mono: 'JetBrains Mono', monospace;

  /* Primary Palette (Emerald Farm Theme) */
  --bp-primary: #10b981;
  --bp-primary-dark: #059669;
  --bp-primary-darker: #047857;
  --bp-primary-light: #d1fae5;
  --bp-primary-subtle: rgba(16, 185, 129, 0.08);

  /* Functional Accents */
  --bp-info: #0284c7;
  --bp-info-light: #e0f2fe;
  --bp-warning: #d97706;
  --bp-warning-light: #fef3c7;
  --bp-danger: #dc2626;
  --bp-danger-light: #fee2e2;
  --bp-purple: #8b5cf6;
  --bp-purple-light: #f3e8ff;

  /* Neutrals (Light Mode default) */
  --bp-bg: #f8fafc;
  --bp-surface: #ffffff;
  --bp-surface-muted: #f1f5f9;
  --bp-border: #e2e8f0;
  --bp-border-dashed: #cbd5e1;
  --bp-text: #0f172a;
  --bp-text-muted: #64748b;
  --bp-text-dim: #94a3b8;

  /* Shadows */
  --bp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --bp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --bp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --bp-shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --bp-radius: 12px;
}

[data-ax-theme="dark"] {
  --bp-bg: #0b1120;
  --bp-surface: #131d32;
  --bp-surface-muted: #1e293b;
  --bp-border: #1e293b;
  --bp-border-dashed: #334155;
  --bp-text: #f8fafc;
  --bp-text-muted: #94a3b8;
  --bp-text-dim: #64748b;
  --bp-primary-subtle: rgba(16, 185, 129, 0.15);
}

/* ============================================================
   PAGE HEADER & BREADCRUMB
   ============================================================ */
.bp-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.bp-page-head-main {
  flex: 1;
  min-width: 280px;
}

.bp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.bp-breadcrumb-tag {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bp-primary-darker);
  background: var(--bp-primary-subtle);
  padding: 2px 8px;
  border-radius: 6px;
}

.bp-breadcrumb-sub {
  color: var(--bp-text-muted);
}

.bp-page-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--bp-text);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.2;
}

.bp-page-subtitle {
  font-size: 0.9rem;
  color: var(--bp-text-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.bp-page-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* ============================================================
   KPI SUMMARY GRID
   ============================================================ */
.bp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.bp-kpi-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.25rem;
  box-shadow: var(--bp-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.bp-kpi-card:hover {
  box-shadow: var(--bp-shadow-md);
}

.bp-kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.bp-kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bp-text-muted);
}

.bp-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.bp-kpi-icon-primary { background: rgba(16, 185, 129, 0.12); color: var(--bp-primary); }
.bp-kpi-icon-info    { background: rgba(2, 132, 199, 0.12); color: var(--bp-info); }
.bp-kpi-icon-warning { background: rgba(245, 158, 11, 0.12); color: var(--bp-warning); }
.bp-kpi-icon-danger  { background: rgba(220, 38, 38, 0.12); color: var(--bp-danger); }
.bp-kpi-icon-purple  { background: rgba(139, 92, 246, 0.12); color: var(--bp-purple); }

.bp-kpi-val {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--bp-text);
  line-height: 1.1;
}

.bp-kpi-val-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bp-text-muted);
}

.bp-kpi-sub {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--bp-text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   CARD COMPONENT
   ============================================================ */
.bp-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: 14px;
  box-shadow: var(--bp-shadow-sm);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.bp-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bp-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--bp-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bp-card-subtitle {
  font-size: 0.825rem;
  color: var(--bp-text-muted);
  margin-top: 2px;
}

.bp-card-body {
  padding: 1.5rem;
}

.bp-card-footer {
  padding: 1rem 1.5rem;
  background: var(--bp-surface-muted);
  border-top: 1px solid var(--bp-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ============================================================
   TABLE COMPONENT
   ============================================================ */
.bp-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.bp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.bp-table thead tr {
  border-bottom: 2px solid var(--bp-border);
}

.bp-table th {
  padding: 0.85rem 0.75rem;
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bp-text-muted);
}

.bp-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--bp-border);
  vertical-align: middle;
  color: var(--bp-text);
}

.bp-table tbody tr {
  transition: background 0.15s ease;
}

.bp-table tbody tr:hover {
  background: var(--bp-surface-muted);
}

.bp-num {
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.bp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.bp-badge-success { background: #dcfce7; color: #15803d; }
.bp-badge-info    { background: #e0f2fe; color: #0369a1; }
.bp-badge-warning { background: #fef3c7; color: #b45309; }
.bp-badge-danger  { background: #fee2e2; color: #b91c1c; }
.bp-badge-neutral { background: #f1f5f9; color: #475569; }
.bp-badge-purple  { background: #f3e8ff; color: #7e22ce; }

/* ============================================================
   BUTTONS
   ============================================================ */
.bp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bp-btn-primary {
  background: var(--bp-primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}
.bp-btn-primary:hover {
  background: var(--bp-primary-dark);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.35);
}

.bp-btn-secondary {
  background: var(--bp-surface);
  border-color: var(--bp-border);
  color: var(--bp-text);
}
.bp-btn-secondary:hover {
  background: var(--bp-surface-muted);
  border-color: var(--bp-border-dashed);
}

.bp-btn-danger {
  background: #ef4444;
  color: #ffffff;
}
.bp-btn-danger:hover {
  background: #dc2626;
}

.bp-btn-ghost {
  background: transparent;
  color: var(--bp-text-muted);
}
.bp-btn-ghost:hover {
  background: var(--bp-surface-muted);
  color: var(--bp-text);
}

.bp-btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
  border-radius: 6px;
}

.bp-btn-pill {
  border-radius: 9999px;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
.bp-form-group {
  margin-bottom: 1.15rem;
}

.bp-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bp-text-muted);
  margin-bottom: 0.4rem;
}

.bp-input, .bp-select, .bp-textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--bp-border);
  background: var(--bp-surface);
  color: var(--bp-text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.bp-input:focus, .bp-select:focus, .bp-textarea:focus {
  outline: none;
  border-color: var(--bp-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.bp-input-addon-group {
  display: flex;
  align-items: stretch;
}

.bp-input-addon-group .bp-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.bp-input-addon {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  background: var(--bp-surface-muted);
  border: 1px solid var(--bp-border);
  border-left: none;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--bp-text-muted);
  white-space: nowrap;
}

/* ============================================================
   MODALS
   ============================================================ */
.bp-modal-backdrop,
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.bp-modal-backdrop.open,
.modal-backdrop.open {
  display: flex !important;
}

.bp-modal-box,
.modal-box {
  background: var(--bp-surface, #ffffff);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--bp-shadow-modal);
  border: 1px solid var(--bp-border);
  overflow: hidden;
  animation: bpModalIn 0.2s ease-out;
}

@keyframes bpModalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.bp-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bp-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--bp-text);
}

.bp-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--bp-text-dim);
  line-height: 1;
  padding: 0;
}
.bp-modal-close:hover {
  color: var(--bp-text);
}

.bp-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Compatibility form & badge classes */
.custom-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--bp-border);
  background: var(--bp-surface);
  color: var(--bp-text);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.custom-input:focus {
  border-color: var(--bp-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.input-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bp-text-dim);
  margin-bottom: 0.35rem;
}

.badge-status-aktif {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-status-istirahat {
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-status-selesai {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* ============================================================
   TABS COMPONENT
   ============================================================ */
.bp-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--bp-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.bp-tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--bp-text-muted);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.bp-tab-btn:hover {
  color: var(--bp-primary);
  background: var(--bp-primary-subtle);
}

.bp-tab-btn.active {
  color: var(--bp-primary);
  border-bottom-color: var(--bp-primary);
  background: var(--bp-primary-subtle);
}

.bp-tab-pane {
  display: none;
}
.bp-tab-pane.active {
  display: block;
}

/* ============================================================
   SIDEBAR GROUP STYLING
   ============================================================ */
.bp-nav-heading {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--bp-text-dim);
  padding: 1rem 0.85rem 0.4rem 0.85rem;
  letter-spacing: 0.08em;
}

.bp-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--bp-text-muted);
  text-decoration: none;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.bp-nav-link:hover {
  background: var(--bp-primary-subtle);
  color: var(--bp-primary);
}

.bp-nav-link.active {
  background: var(--bp-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.bp-nav-link svg {
  flex-shrink: 0;
}
