/* ==========================================================================
   DAVS FARM EQUIPMENT — ADMIN PORTAL GLOBAL STYLES (ADMIN.CSS)
   Aesthetic: Heavy-Duty Industrial Ag Control Console
   Palette: Forest Green, Harvest Amber, Chassis Steel & Clean Parchment
   ========================================================================== */

:root {
  /* Brand Earth & Forest Tones */
  --admin-forest-950: #06140c;
  --admin-forest-900: #0d2617;
  --admin-forest-800: #143823;
  --admin-forest-700: #1a472a;
  --admin-forest-600: #245e38;
  --admin-forest-100: #e2ede5;
  --admin-forest-50:  #f0f6f2;

  /* Harvest Amber Accents */
  --admin-amber-600: #b45309;
  --admin-amber-500: #d97706;
  --admin-amber-400: #f59e0b;
  --admin-amber-100: #fef3c7;
  --admin-amber-50:  #fffbeb;

  /* Steel Chassis Neutrals */
  --admin-steel-950: #090d16;
  --admin-steel-900: #0f172a;
  --admin-steel-800: #1e293b;
  --admin-steel-700: #334155;
  --admin-steel-600: #475569;
  --admin-steel-500: #64748b;
  --admin-steel-400: #94a3b8;
  --admin-steel-300: #cbd5e1;
  --admin-steel-200: #e2e8f0;
  --admin-steel-100: #f1f5f9;
  --admin-steel-50:  #f8fafc;

  /* Fonts */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dimensions & Radius */
  --sidebar-width: 270px;
  --topbar-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
}

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

html {
  font-family: var(--font-body);
  color: var(--admin-steel-900);
  background-color: var(--admin-steel-50);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  background-color: #f8fafc;
}

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

button {
  font-family: inherit;
}

/* ==========================================================================
   ADMIN LAYOUT STRUCTURE
   ========================================================================== */

.admin-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background-color: var(--admin-steel-950);
  background-image: linear-gradient(180deg, var(--admin-forest-950) 0%, var(--admin-steel-950) 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  border-right: 1.5px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--admin-forest-800) 0%, var(--admin-forest-900) 100%);
  border: 1.5px solid var(--admin-amber-500);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  font-weight: 900;
  font-size: 1.15rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-brand-title span {
  color: var(--admin-amber-400);
}

.sidebar-brand-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--admin-forest-100);
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.925rem;
  font-weight: 600;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-nav-item svg {
  color: #64748b;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.sidebar-nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.sidebar-nav-item:hover svg {
  color: var(--admin-amber-400);
}

.sidebar-nav-item.active {
  background-color: var(--admin-forest-800);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-nav-item.active svg {
  color: #fbbf24;
}

.sidebar-nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  background-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.sidebar-nav-item.active .sidebar-nav-badge {
  background-color: var(--admin-amber-500);
  color: #ffffff;
}

.sidebar-footer {
  padding: 1.25rem 1rem;
  border-top: 1.5px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.view-site-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: rgba(217, 119, 6, 0.15);
  border: 1px solid var(--admin-amber-500);
  color: #fbbf24;
  font-size: 0.825rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.view-site-btn:hover {
  background: var(--admin-amber-500);
  color: #ffffff;
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--admin-forest-700);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  border: 1.5px solid var(--admin-forest-600);
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-user-name {
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-role {
  color: #94a3b8;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Topbar */
.admin-topbar {
  height: var(--topbar-height);
  background-color: #ffffff;
  border-bottom: 1.5px solid var(--admin-steel-200);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mobile-sidebar-toggle {
  display: none;
  background: transparent;
  border: 1.5px solid var(--admin-steel-300);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  color: var(--admin-steel-800);
  cursor: pointer;
}

.topbar-page-context {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--admin-forest-900);
  line-height: 1.2;
}

.topbar-breadcrumbs {
  font-size: 0.78rem;
  color: var(--admin-steel-500);
  font-family: var(--font-mono);
  display: flex;
  gap: 0.35rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.yard-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--admin-forest-50);
  border: 1px solid var(--admin-forest-100);
  color: var(--admin-forest-800);
  font-size: 0.78rem;
  font-weight: 700;
}

.yard-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Page Body Container */
.admin-content {
  flex: 1;
  padding: 2rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Backdrop Overlay for Mobile Drawer */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}

/* ==========================================================================
   COMMON ADMIN COMPONENTS
   ========================================================================== */

/* Flash Alerts */
.admin-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.3s ease-out;
}

.admin-alert-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-alert-success {
  background-color: #f0fdf4;
  color: #14532d;
  border: 1.5px solid #86efac;
}

.admin-alert-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0.25rem;
  opacity: 0.7;
}

.admin-alert-close:hover {
  opacity: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn-forest {
  background-color: var(--admin-forest-800);
  color: #ffffff;
  border-color: var(--admin-forest-800);
}

.btn-forest:hover {
  background-color: var(--admin-forest-900);
  border-color: var(--admin-forest-900);
}

.btn-primary {
  background-color: var(--admin-amber-500);
  color: #ffffff;
  border-color: var(--admin-amber-600);
}

.btn-primary:hover {
  background-color: var(--admin-amber-600);
  border-color: var(--admin-amber-700);
}

.btn-outline-forest {
  background-color: transparent;
  color: var(--admin-forest-800);
  border-color: var(--admin-forest-800);
}

.btn-outline-forest:hover {
  background-color: var(--admin-forest-800);
  color: #ffffff;
}

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

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

.btn-outline-danger {
  background-color: transparent;
  color: #ef4444;
  border-color: #fca5a5;
}

.btn-outline-danger:hover {
  background-color: #fee2e2;
  color: #dc2626;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
  height: 38px;
}

.btn-md {
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  height: 46px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1.5px solid var(--admin-steel-300);
  color: var(--admin-steel-700);
}

.btn-icon:hover {
  border-color: var(--admin-forest-800);
  color: var(--admin-forest-800);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.badge-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.badge-info {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* Admin Cards */
.admin-card {
  background: #ffffff;
  border: 1.5px solid var(--admin-steel-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 2rem;
}

.admin-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1.5px solid var(--admin-steel-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
}

.admin-card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-forest-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background-color: var(--admin-steel-100);
  color: var(--admin-steel-700);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.25rem;
  border-bottom: 1.5px solid var(--admin-steel-200);
  white-space: nowrap;
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--admin-steel-200);
  color: var(--admin-steel-800);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background-color: #f8fafc;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--admin-steel-800);
  margin-bottom: 0.4rem;
}

.form-label span.required {
  color: #ef4444;
}

.form-control {
  width: 100%;
  height: 48px;
  padding: 0 1rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  color: var(--admin-steel-900);
  background-color: #ffffff;
  border: 1.5px solid var(--admin-steel-300);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-forest-800);
  box-shadow: 0 0 0 3px rgba(20, 56, 35, 0.15);
}

textarea.form-control {
  height: auto;
  min-height: 120px;
  padding: 0.85rem 1rem;
  line-height: 1.6;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  appearance: none;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--admin-steel-500);
  margin-top: 0.35rem;
}

.form-error {
  font-size: 0.8rem;
  color: #ef4444;
  font-weight: 600;
  margin-top: 0.35rem;
}

/* Modals */
.admin-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal.active {
  display: flex !important;
}

.admin-modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--admin-steel-200);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.admin-modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-forest-900);
}

.admin-modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.admin-modal-footer {
  padding: 1rem 1.5rem;
  background-color: var(--admin-steel-50);
  border-top: 1.5px solid var(--admin-steel-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (ADMIN)
   ========================================================================== */

@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  .admin-content {
    padding: 1.5rem 1rem;
  }

  .admin-topbar {
    padding: 0 1rem;
  }

  .yard-status-pill {
    display: none;
  }
}

