/* Naby-RSAgri GIS Viewer - layout and agricultural green theme */

:root {
  --agri-green-900: #14311c;
  --agri-green-800: #1c4527;
  --agri-green-700: #256034;
  --agri-green-500: #3f8f4f;
  --agri-green-300: #8fc79a;
  --agri-soil: #6b4f2a;
  --agri-wheat: #e8c76a;
  --panel-bg: #ffffff;
  --panel-border: #d9e2d9;
  --app-bg: #f2f6f1;
  --text-muted: #5f6d61;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--app-bg);
  color: #21281f;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* ------------------------------------------------------------------ */
/* App grid                                                            */
/* ------------------------------------------------------------------ */

.app-shell {
  display: grid;
  grid-template-rows: 64px 1fr auto;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: linear-gradient(90deg, var(--agri-green-900), var(--agri-green-700));
  color: #f4fbf3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

.app-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.app-brand .brand-mark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.app-brand .brand-sub {
  font-size: 12px;
  color: var(--agri-green-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--agri-wheat);
  box-shadow: 0 0 6px var(--agri-wheat);
}

.status-pill.is-ready .status-dot {
  background: #7ef0a0;
  box-shadow: 0 0 6px #7ef0a0;
}

/* ------------------------------------------------------------------ */
/* Main three-pane layout                                              */
/* ------------------------------------------------------------------ */

.main-layout {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  gap: 12px;
  padding: 12px;
  min-height: 0;
  overflow: hidden;
}

.side-banner {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(20, 49, 28, 0.08);
}

.map-pane {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 0;
  box-shadow: 0 1px 3px rgba(20, 49, 28, 0.08);
}

.map-pane .leaflet-container,
.map-pane .maplibregl-map,
.map-pane .maplibregl,
.map-pane .html-widget {
  height: 100% !important;
  width: 100% !important;
  background: #dfe7dc;
}

/* ------------------------------------------------------------------ */
/* WebGL warning overlay                                               */
/* ------------------------------------------------------------------ */

.webgl-warning {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1000;
  padding: 16px 18px;
  border: 1px solid #d9a441;
  border-radius: 10px;
  background: #fff8e6;
  color: #5a4310;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(20, 49, 28, 0.18);
}

.webgl-warning h3 {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 700;
  color: #8a5b00;
}

.webgl-warning p {
  margin: 0 0 8px 0;
}

.webgl-warning p:last-child {
  margin-bottom: 0;
}

.webgl-warning code {
  background: #f3e6c4;
  color: #5a4310;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
}

.panel-title {
  margin: 0 0 10px 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--agri-green-800);
  border-bottom: 2px solid var(--agri-green-300);
  padding-bottom: 6px;
}

.panel-section {
  margin-bottom: 18px;
}

.panel-section > label,
.panel-section .control-label,
.control-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--agri-green-800);
  margin-bottom: 5px;
}

.panel-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 10px 0;
  line-height: 1.4;
}

.panel-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.panel-placeholder {
  border: 1px dashed var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  color: var(--text-muted);
  background: #fafcf9;
}

/* ------------------------------------------------------------------ */
/* Form controls                                                       */
/* ------------------------------------------------------------------ */

.side-banner .form-control,
.side-banner .form-group input[type="text"] {
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
}

.side-banner .btn {
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  width: 100%;
}

.btn-agri {
  background: var(--agri-green-700);
  border-color: var(--agri-green-800);
  color: #f4fbf3;
}

.btn-agri:hover,
.btn-agri:focus {
  background: var(--agri-green-800);
  color: #ffffff;
}

.btn-soil {
  background: var(--agri-soil);
  border-color: #55401f;
  color: #fdf6e8;
}

.btn-soil:hover,
.btn-soil:focus {
  background: #55401f;
  color: #ffffff;
}

.side-banner .progress {
  height: 6px;
  margin-bottom: 6px;
}

.side-banner .irs--shiny .irs-bar,
.side-banner .irs-bar {
  background: var(--agri-green-500);
  border-color: var(--agri-green-500);
}

.side-banner .irs--shiny .irs-handle > i:first-child {
  background: var(--agri-green-800);
}

.side-banner .checkbox label,
.side-banner .radio label {
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* Bottom drawer                                                       */
/* ------------------------------------------------------------------ */

.bottom-panel {
  height: 260px;
  margin: 0 12px 12px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -1px 4px rgba(20, 49, 28, 0.08);
}

.bottom-panel .nav-tabs {
  border-bottom: 1px solid var(--panel-border);
  background: #eef4ec;
  padding: 0 8px;
  flex: 0 0 auto;
}

.bottom-panel .nav-tabs > li > a {
  font-size: 12px;
  font-weight: 600;
  color: var(--agri-green-800);
  border: none;
  border-radius: 0;
  padding: 8px 14px;
}

.bottom-panel .nav-tabs > li.active > a,
.bottom-panel .nav-tabs > li.active > a:hover,
.bottom-panel .nav-tabs > li.active > a:focus {
  background: var(--panel-bg);
  border: none;
  border-bottom: 3px solid var(--agri-green-500);
  color: var(--agri-green-900);
}

.bottom-panel .tab-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
}

.bottom-panel .tab-pane {
  font-size: 12px;
}

.meta-block {
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 0;
  color: #26331f;
}

.log-block {
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  margin: 0;
  background: #14311c;
  color: #cfeacd;
  border-radius: 6px;
  padding: 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

table.dataTable {
  font-size: 11px !important;
}

/* ------------------------------------------------------------------ */
/* Responsive single-column breakpoint                                 */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .main-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .side-banner {
    overflow: visible;
  }

  .map-pane {
    height: 60vh;
    min-height: 380px;
  }

  .bottom-panel {
    height: auto;
    min-height: 260px;
  }

  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
  }
}
