/* Main Layout Architecture */
.app-container {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-page);
  width: 100%;
}

/* Full-Height Sticky Sidebar Navigation (Compact Sleek Theme) */
.sidebar {
  width: 215px;
  min-width: 215px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #063c22 0%, #0a4d2c 50%, #06331d 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 16px 12px;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 16px rgba(6, 60, 34, 0.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 16px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 14px;
}

.brand-logo-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  padding: 3px;
}

.brand-wheat-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.brand-accent {
  color: #4ade80;
  font-weight: 800;
}

.brand-tagline {
  font-size: 0.6rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

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

.nav-item.active {
  background: #ffffff;
  color: #064e3b;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.nav-item.active .nav-icon {
  stroke: #064e3b;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

/* Sidebar Promotional Card */
.sidebar-promo-card {
  margin-top: 24px;
  background: linear-gradient(180deg, rgba(12, 90, 54, 0.9) 0%, rgba(6, 46, 27, 0.98) 100%),
              url('../assets/images/hero-field.jpg');
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md);
  padding: 14px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.promo-farmer-img {
  width: 100%;
  height: 115px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: block;
}

.promo-text {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.promo-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.promo-logo-mini {
  width: 20px;
  height: 20px;
}

.promo-subtext {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.15;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  background: var(--bg-page);
}

/* Top Navbar (Spanning all the way to right side) */
.top-navbar {
  height: 58px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 480px;
}

.navbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  width: 100%;
  transition: all 0.2s ease;
}

.navbar-search:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(12, 90, 54, 0.12);
}

.navbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.86rem;
  color: var(--text-main);
  width: 100%;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-btn-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.navbar-btn-create:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(12, 90, 54, 0.2);
  transform: translateY(-1px);
}

.user-profile-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-default);
  transition: all 0.15s ease;
}

.notif-btn:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
}

.profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.profile-widget:hover {
  background: #f1f5f9;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--primary-border);
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.profile-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.profile-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Full-Width Dashboard Content Grid */
.dashboard-content {
  padding: 28px 36px 56px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 100%;
}

/* Hero Panoramic Banner (Full-Width) */
.hero-banner {
  background: linear-gradient(90deg, rgba(6, 46, 27, 0.95) 0%, rgba(12, 90, 54, 0.88) 40%, rgba(12, 90, 54, 0.35) 75%, transparent 100%),
              url('../assets/images/hero-field.jpg');
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  padding: 28px 34px;
  color: #ffffff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  width: 100%;
}

.hero-text-group {
  max-width: 100%;
  z-index: 2;
}

.hero-title {
  font-size: 1.65rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  margin-bottom: 16px;
}

.hero-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-location-change {
  color: #86efac;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  text-decoration: underline;
}

.hero-slogan-badge {
  text-align: right;
  z-index: 2;
  font-style: italic;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fef08a;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  line-height: 1.25;
  padding-right: 15px;
}

/* Stat Cards Grid (4 Cards Spanning Full Width) */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper.green {
  background: #dcfce7;
  color: #16a34a;
}

.stat-icon-wrapper.blue {
  background: #dbeafe;
  color: #2563eb;
}

.stat-icon-wrapper.purple {
  background: #f3e8ff;
  color: #7e22ce;
}

.stat-icon-wrapper.orange {
  background: #ffedd5;
  color: #ea580c;
}

.stat-meta {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.stat-arrow-icon {
  width: 15px;
  height: 15px;
  color: var(--text-light);
  transition: transform 0.15s;
}

.stat-card:hover .stat-arrow-icon {
  transform: translateX(3px);
  color: var(--primary);
}

/* Listings Table (Full Width) */
.listings-table-container {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-default);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 14px 18px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #fbfdfc;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.crop-cell {
  display: flex;
  align-items: center;
  gap: 14px;
}

.crop-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.crop-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.price-main {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.92rem;
}

.price-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Bottom Grid (Mandi + Forecast) */
.market-forecast-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  width: 100%;
}

/* Mandi Prices List */
.mandi-list {
  display: flex;
  flex-direction: column;
}

.mandi-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.3fr;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.mandi-row:last-child {
  border-bottom: none;
}

.mandi-crop-name {
  font-weight: 700;
  color: var(--text-main);
}

.mandi-price {
  font-weight: 700;
  color: var(--text-main);
}

.mandi-trend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-weight: 700;
  font-size: 0.82rem;
}

.trend-up {
  color: #16a34a;
}

.trend-down {
  color: #dc2626;
}

.sparkline-svg {
  width: 75px;
  height: 26px;
  overflow: visible;
}

/* Price Forecast Card */
.forecast-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.forecast-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

.forecast-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.forecast-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-default);
}

.forecast-crop-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.forecast-duration {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.forecast-percentage {
  font-size: 1.35rem;
  font-weight: 800;
  color: #16a34a;
  text-align: right;
  line-height: 1.1;
}

.forecast-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.forecast-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: #f0fdf4;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
}

/* Responsive */
@media (max-width: 1200px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .market-forecast-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }
  .top-navbar {
    padding: 0 16px;
  }
  .stat-cards-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-content {
    padding: 16px;
  }
}

/* ==========================================================================
   Open-Source Google Maps Engine Controls & Telematics Styles
   ========================================================================== */
.map-layer-selector-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 2px;
}

.map-layer-btn {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  background: transparent;
  color: #475569;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.map-layer-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.map-layer-btn.active {
  background: #ffffff;
  color: #0c5a36;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#btn-map-traffic.active {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.map-fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 16px !important;
  background: #ffffff !important;
  box-shadow: none !important;
}

.map-fullscreen-active #logistics-radar-map,
.map-fullscreen-active .dc-leaflet-container {
  height: calc(100vh - 85px) !important;
}
