/* ===========================================
   CLIMATE ADJUSTED PROVENANCING TOOL STYLES
   =========================================== */
@import url('./shared-colors.css');
@import url('./base-components.css');

/* ===========================================
   PROVENANCING SPECIFIC
   =========================================== */
.main-layout {
  grid-template-columns: 320px 1fr;
}

.filter-card,
.results-card {
  margin-bottom: 1.5rem;
}

/* Step Sections */
.step-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
}

.step-section:hover {
  box-shadow: 0 4px 15px var(--shadow-light);
  transform: translateY(-2px);
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--primary-green);
  font-size: 1.1rem;
}

.step-header-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-number,
.step-number-main {
  background: linear-gradient(135deg, var(--primary-green), var(--success-green));
  color: var(--text-white);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  margin-right: 0.75rem;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  flex-shrink: 0;
}

.step-number-main {
  width: 32px;
  height: 32px;
  font-size: 1rem;
}

.step-header label {
  margin: 0;
  display: flex;
  align-items: center;
  flex: 1;
}

.step-header i {
  margin-right: 0.5rem;
  color: var(--success-green);
}

/* Form Groups */
.form-group {
  margin-bottom: 1.5rem;
}

.input-label {
  font-weight: 600;
  color: var(--primary-green);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.input-label i {
  margin-right: 0.5rem;
  color: var(--success-green);
}

/* Coordinate Inputs */
.coordinate-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.coord-input-group {
  display: flex;
  flex-direction: column;
}

.coord-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  font-weight: 500;
}

/* Shiny Input Styling */
.shiny-input-container {
  margin-bottom: 1rem;
}

.shiny-input-container label {
  font-weight: 600;
  color: var(--primary-green);
  margin-bottom: 0.5rem;
}

.shiny-input-container select,
.shiny-input-container input[type="number"] {
  width: 100%;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.shiny-input-container select:focus,
.shiny-input-container input[type="number"]:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

/* Growth Habits Section */
.habits-container {
  max-height: none !important;
  overflow-y: visible !important;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 3rem;
  background: var(--bg-primary);
}

.habits-container .shiny-input-checkboxgroup {
  max-height: none !important;
}

.habits-container .shiny-input-checkboxgroup .shiny-options-group {
  max-height: none !important;
  overflow-y: visible !important;
  column-count: 2;
  column-gap: 15px;
}

.habits-container .shiny-input-checkboxgroup .shiny-options-group .checkbox {
  margin-bottom: 3px !important;
  margin-top: 3px !important;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
}

.clear-all-btn {
  margin-bottom: 10px;
  font-size: 11px;
  padding: 2px 8px;
  width: auto;
  float: right;
  border: 1px solid var(--text-muted);
  background-color: transparent;
  color: var(--text-muted);
}

.clear-all-btn:hover {
  background-color: var(--text-muted);
  color: var(--text-white);
}

.habits-controls {
  overflow: hidden;
  margin-bottom: 5px;
}

.habits-container::-webkit-scrollbar {
  width: 8px;
}

.habits-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.habits-container::-webkit-scrollbar-thumb {
  background: var(--primary-green-lighter);
  border-radius: 4px;
}

.habits-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-green);
}

.shiny-options-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.shiny-options-group .checkbox {
  margin: 0.3rem 0;
}

.shiny-options-group input[type="checkbox"] {
  margin-right: 0.5rem;
  transform: scale(1.1);
  accent-color: var(--primary-green);
}

.shiny-options-group label {
  font-weight: normal;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.shiny-options-group label:hover {
  background-color: var(--hover-overlay);
}

/* Download Section */
.download-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-light);
}

.download-title {
  color: var(--primary-green);
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

.download-title i {
  margin-right: 0.5rem;
  color: var(--success-green);
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-download {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: var(--text-white);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(76, 175, 80, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-download:hover {
  background: linear-gradient(135deg, var(--primary-green-dark), var(--success-green));
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.btn-download:active {
  transform: translateY(0);
}

.btn-map-data {
  background: linear-gradient(135deg, #17a2b8, #138496);
}

.btn-map-data:hover {
  background: linear-gradient(135deg, #1cc7e0, #17a2b8);
}

.btn-species-data {
  background: linear-gradient(135deg, #28a745, #20913a);
}

.btn-species-data:hover {
  background: linear-gradient(135deg, #34ce57, #28a745);
}

/* ===========================================
   MAIN PANEL CARDS
   =========================================== */
.map-container,
.plot-container,
.species-map-container {
  padding: 1.5rem;
}

.map-description {
  margin: 1rem 0 0 0;
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  font-size: 0.95rem;
}

/* Selected Species Display */
#variable_name {
  font-weight: 600;
  color: var(--primary-green-dark);
  font-style: italic;
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* ===========================================
   LEAFLET MAP CUSTOMIZATION
   =========================================== */
.leaflet-container {
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-light);
}

.leaflet-popup-content {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

.leaflet-popup-content strong {
  color: var(--primary-green);
}

/* ===========================================
   PLOT CUSTOMIZATION
   =========================================== */
.shiny-plot-output {
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-light);
  background: var(--bg-primary);
}

/* ===========================================
   NOTIFICATIONS
   =========================================== */
.shiny-notification {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-light));
  color: var(--text-white);
  border-radius: 8px;
  box-shadow: 0 4px 15px var(--shadow-medium);
  border: none;
}

.shiny-notification-message {
  font-weight: 500;
}

.shiny-notification-close {
  color: var(--text-white);
  opacity: 0.8;
}

.shiny-notification-close:hover {
  opacity: 1;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */
@media (max-width: 1200px) {
  .main-layout {
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
  }
  
  .coordinate-inputs {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 992px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .sidebar {
    position: static;
  }
  
  .step-section {
    padding: 1rem;
  }
  
  .download-buttons {
    flex-direction: row;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    text-align: center;
  }
  
  .app-header {
    padding: 1rem 0;
  }
  
  .app-header h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
  }
  
  .main-container {
    padding: 0 0.5rem;
  }
  
  .info-card,
  .filter-body,
  .map-container,
  .plot-container {
    padding: 1rem;
  }
  
  .step-section {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .download-buttons {
    flex-direction: column;
  }
  
  .coordinate-inputs {
    grid-template-columns: 1fr;
  }
  
  .shiny-options-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .header-container,
  .main-container,
  .footer-container {
    padding: 0 0.5rem;
  }
  
  .app-header h1 {
    font-size: 1.6rem;
  }
  
  .home-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .step-number,
  .step-number-main {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }
  
  .step-number-main {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */
.btn-download:focus,
.shiny-input-container select:focus,
.shiny-input-container input:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* ===========================================
   LOADING STATES
   =========================================== */
.recalculating {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

/* ===========================================
   PRINT STYLES
   =========================================== */
@media print {
  .app-header,
  .app-footer,
  .sidebar {
    display: none;
  }
  
  .main-layout {
    grid-template-columns: 1fr;
  }
  
  .results-card {
    box-shadow: none;
    border: 1px solid var(--border-light);
  }
}