/* 1. Reset & Base */
:root {
  /* Brand Colors - Pasture Green Series */
  --primary: #15803d;
  /* Brand Green */
  --primary-hover: #166534;
  --primary-light: #dcfce7;

  /* Neutral Color Palette */
  --bg-color: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #0f172a;
  /* Deep Slate */
  --text-muted: #64748b;
  --border: #e2e8f0;

  /* Semantic Colors */
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Shadows - Layered for Depth */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 24px -6px rgba(15, 23, 42, 0.08), 0 8px 16px -8px rgba(15, 23, 42, 0.06);
  --shadow-premium: 0 20px 40px -5px rgba(15, 23, 42, 0.1);

  /* Radius */
  --radius-pill: 100px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* 2. Top Navigation */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-item {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}

.nav-item:hover {
  color: var(--primary);
}

/* 3. Main Dashboard Area */
.dashboard-container {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* Global Page Container fallback */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}

/* 4. Search Section (The "Google" Part) */
.search-wrapper {
  margin-top: 4rem;
  /* Visual balance */
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 100;
}

.search-input-container {
  width: 100%;
  max-width: 600px;
  position: relative;
}

input#main-search {
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-size: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 50px;
  /* Pill shape */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  outline: none;
}

input#main-search:focus {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.micro-copy {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* 5. Search Results Dropdown */
#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  /* Hidden by default */
}

#search-results.active {
  display: block;
}

.result-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background-color: #f1f5f9;
}

.result-tag {
  font-weight: 600;
  font-size: 1.1rem;
}

.result-herd {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 6. Bottom Grid (Jobs, Runs, Actions) */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  margin-top: auto;
  /* Push to bottom if space allows */
  padding-bottom: 2rem;
}

.card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.section-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Job List */
.job-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.job-item:last-child {
  border-bottom: none;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.5rem;
}

.status-red {
  background: var(--danger);
}

.status-orange {
  background: var(--warning);
}

.status-green {
  background: var(--success);
}

/* Quick Actions */
.action-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--bg-color);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.action-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.action-btn.primary {
  background: var(--primary);
  color: white;
  border: none;
}

.action-btn.primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* 7. Premium UI Utilities */
.card-premium {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-premium);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-premium:hover {
  transform: translateY(-4px);
  box-shadow: 0 32px 64px -12px rgba(15, 23, 42, 0.15);
}

.header-standalone {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  color: white !important;
  padding: 1.75rem 2.5rem;
  border-radius: var(--radius-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 2rem;
}

.header-standalone h3,
.header-standalone h2 {
  margin-bottom: 0;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: white !important;
}

.btn-premium {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-premium:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -4px rgba(21, 128, 61, 0.3);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(4px);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 1rem;
  }

  .search-wrapper {
    margin-top: 1rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .navbar {
    padding: 1rem;
  }

  .nav-links span {
    display: none;
  }

  /* Hide text on mobile */
}

/* Bull Upload Styles */
.upload-card {
  max-width: 600px;
  margin: 2rem auto;
  text-align: center;
}

#drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 3rem 2rem;
  margin: 1.5rem 0;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}

#drop-zone.highlight {
  border-color: var(--primary);
  background: #eff6ff;
}

#drop-zone p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.upload-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.mode-selector {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  text-align: left;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.progress-container {
  display: none;
  width: 100%;
  background-color: #e2e8f0;
  border-radius: 999px;
  margin-top: 1rem;
  height: 0.75rem;
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background-color: var(--primary);
  transition: width 0.3s;
}

/* Protocol Builder Styles */
.builder-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  padding: 1rem 0;
}

.step-card {
  border-left: 4px solid var(--primary);
  margin-bottom: 1.5rem;
  transition: all 0.2s ease;
  border-right: none;
  border-top: none;
  border-bottom: none;
  /* Simplified card look */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.step-handle {
  cursor: grab;
  padding: 0.5rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.step-handle:hover {
  color: var(--primary);
}

.step-handle:active {
  cursor: grabbing;
}

.timeline-container {
  position: sticky;
  top: 2rem;
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  max-height: 80vh;
  overflow-y: auto;
}

.timeline-item {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 2px solid var(--border);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-day {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--danger);
  background-color: #fee2e2;
  border-radius: 4px;
}




.page-title-banner {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.saved-protocol-item {
  transition: all 0.2s;
  border: 1px solid transparent;
}

.saved-protocol-item:hover {
  background-color: #f8fafc;
  border-color: var(--border);
  transform: translateX(2px);
}

/* =========================================
   5. Standardized Theme (From Dashboard)
   ========================================= */

/* Cinematic Farm Background */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Roboto', 'Inter', sans-serif;
  /* High Res Farm Image from Unsplash */
  background:
    linear-gradient(to bottom,
      rgba(135, 206, 235, 0.4) 0%,
      rgba(255, 255, 255, 0.2) 40%,
      rgba(126, 211, 33, 0.3) 100%),
    url('https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&q=80&w=2000');
  background-size: cover;
  background-position: center bottom;
  background-attachment: fixed;
  /* Keeps background static while scrolling */
}


/* =========================================
   6. Authentication Pages & Forms
   ========================================= */

.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 0;
  margin: 0;
  /* Cinematic Background inherited from body in section 5 */
}

/* Overlay to ensure text readability over background */
.auth-overlay {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
  /* Subtle blur of the farm background */
  background: rgba(0, 0, 0, 0.1);
  /* Slight darken */
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.4);
  width: 100%;
  max-width: 420px;
  padding: 3.5rem 2.5rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Green top accent */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  color: var(--text-main);
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #f8fafc;
  color: var(--text-main);
  box-sizing: border-box;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.form-control:focus {
  outline: none;
  border-color: var(--success);
  background: white;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  text-decoration: none;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.w-100 {
  width: 100%;
}