/* 
  piante. - Indie-Minimal Hipster Web App Stylesheet
  Design philosophy: Mobile-first, bold typography, tactile neobrutalist borders, organic colors.
*/

:root {
  --bg-color: #fbfbf9;
  --card-bg: #ffffff;
  --text-primary: #2d241e;
  --text-secondary: #6e5e54;
  --border-color: #2d241e;
  --primary: #4f6f52;
  --primary-light: #ecefe6;
  --accent-terracotta: #d08c60;
  --accent-ochre: #dfa644;
  --accent-sage: #86a789;
  --danger: #b3543d;
  --radius-lg: 20px;
  --radius-md: 12px;
  --border-width: 2px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --shadow-flat: 4px 4px 0px #2d241e;
  --shadow-flat-hover: 6px 6px 0px #2d241e;
  --shadow-flat-active: 2px 2px 0px #2d241e;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: #eae9e3; /* Slightly darker surrounding environment to frame the mobile app */
  color: var(--text-primary);
  font-family: var(--font-sans);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

/* App container limits width to an iPhone/Android screen size on desktop */
.app-container {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background-color: var(--bg-color);
  padding: 24px 20px 110px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

@media(max-width: 480px) {
  .app-container {
    max-width: 100%;
    min-height: 100vh;
    box-shadow: none;
  }
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  font-size: 24px;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -1px;
}

/* Cards Design */
.card {
  background-color: var(--card-bg);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-flat);
  padding: 20px;
  margin-bottom: 24px;
  transition: all 0.2s ease;
}

/* Weather & Health Insights Panel */
.weather-panel {
  background-color: var(--primary-light);
  border-color: var(--border-color);
}

.weather-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.weather-icon-temp {
  display: flex;
  align-items: center;
  gap: 10px;
}

.weather-icon {
  font-size: 24px;
  color: var(--accent-ochre);
}

#weather-temp {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.weather-location-container {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.05);
  padding: 4px 10px;
  border-radius: 20px;
}

.weather-summary {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.weather-badge-status {
  display: inline-block;
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
}

/* Dashboard plant header section */
.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title-bar h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.plant-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  background: #eae9e3;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Plants Grid */
.plants-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Plant Card */
.plant-card {
  display: flex;
  flex-direction: column;
  background-color: var(--card-bg);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-flat);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.plant-card-media {
  height: 180px;
  width: 100%;
  position: relative;
  background-color: #f1ebd9;
  border-bottom: var(--border-width) solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
}

.plant-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plant-placeholder-art {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.plant-placeholder-art .emoji {
  font-size: 54px;
}

.plant-placeholder-art .placeholder-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.plant-card-content {
  padding: 18px;
}

.plant-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.plant-titles {
  display: flex;
  flex-direction: column;
}

.plant-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}

.plant-specie {
  font-size: 13px;
  font-style: italic;
  color: var(--text-secondary);
}

.health-status-badge {
  padding: 5px 10px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-status-badge.ottimo {
  background-color: var(--accent-sage);
  color: #fff;
}

.health-status-badge.assetata {
  background-color: var(--accent-ochre);
  color: var(--text-primary);
}

.health-status-badge.critico {
  background-color: var(--accent-terracotta);
  color: #fff;
}

.plant-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #dedbd3;
}

.info-label {
  color: var(--text-secondary);
}

.info-value {
  font-weight: 600;
}

/* Buttons System - Bottom Sticky Navigation Bar */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background-color: var(--bg-color);
  border-top: var(--border-width) solid var(--border-color);
  padding: 16px 20px;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
  z-index: 900;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media(max-width: 480px) {
  .bottom-nav-bar {
    max-width: 100%;
  }
}

.btn-add-large {
  width: 100%;
  height: 52px;
  background-color: var(--primary);
  color: #ffffff;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.btn-add-large:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-flat-active);
}

.plant-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-touch {
  height: 48px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--border-color);
  box-shadow: 2px 2px 0px #2d241e;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background-color: #fff;
  transition: all 0.1s ease;
}

.btn-touch:active {
  transform: translate(1.5px, 1.5px);
  box-shadow: 0.5px 0.5px 0px #2d241e;
}

.btn-water {
  background-color: #dbeafe; /* Nice soft water blue */
  color: #1e3a8a;
}

.btn-details {
  background-color: var(--primary-light);
  color: var(--primary);
  grid-column: span 2;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background-color: var(--card-bg);
  border: var(--border-width) dashed var(--text-secondary);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Drawers & Overlays */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(45, 36, 30, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
  z-index: 99999 !important;
}

.drawer {
  width: 100%;
  max-width: 430px;
  background-color: var(--bg-color);
  border-top: var(--border-width) solid var(--border-color);
  border-left: var(--border-width) solid var(--border-color);
  border-right: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}

.drawer-overlay.active .drawer {
  transform: translateY(0);
}

.drawer-handle {
  width: 40px;
  height: 5px;
  background-color: var(--text-secondary);
  opacity: 0.3;
  border-radius: 3px;
  margin: -10px auto 16px auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.drawer-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background-color: #eae9e3;
}

/* Forms Styling */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.col {
  flex: 1;
}

label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 12px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-primary);
  width: 100%;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 2px 2px 0px var(--primary);
}

.btn-submit {
  width: 100%;
  height: 52px;
  margin-top: 10px;
  background-color: var(--primary);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 16px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-flat);
  cursor: pointer;
  transition: all 0.1s ease;
}

.btn-submit:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-flat-active);
}

/* Details Drawer Styling */
.drawer-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-meta-card {
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.detail-specie {
  font-size: 14px;
  font-style: italic;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

.detail-notes {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.detail-stats {
  display: flex;
  gap: 12px;
}

.stat-box {
  flex: 1;
  background: var(--bg-color);
  padding: 10px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 13px;
  font-weight: 700;
}

.detail-section h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-sub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-sub-header h4 {
  margin-bottom: 0;
}

/* File Upload Button */
.btn-file-upload {
  padding: 6px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 2px 2px 0px #2d241e;
  transition: all 0.1s ease;
}

.btn-file-upload:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #2d241e;
}

/* EXIF Preview Card */
.exif-preview-card {
  background-color: var(--primary-light);
  margin-bottom: 16px;
}

.exif-preview-card h5 {
  font-size: 14px;
  margin-bottom: 10px;
  font-family: var(--font-display);
}

.exif-flex {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

#exif-img-preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
}

.exif-data-list {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.exif-actions {
  display: flex;
  gap: 10px;
}

.btn-exif-save {
  flex: 2;
  height: 38px;
  background-color: var(--primary);
  color: #fff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.btn-exif-cancel {
  flex: 1;
  height: 38px;
  background-color: #eae9e3;
  color: var(--text-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* Photo Gallery */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gallery-item {
  aspect-ratio: 1;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background-color: #dedbd3;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-geo-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 4px;
}

/* Irrigation Log List */
.irrigation-logs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.log-date {
  font-weight: 600;
}

.log-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.log-amount {
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
}

.log-meteo {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Danger zone / delete button */
.danger-zone {
  margin-top: 10px;
  border-top: 1px dashed #dedbd3;
  padding-top: 20px;
}

.btn-delete {
  width: 100%;
  height: 48px;
  background-color: #fef2f2;
  color: var(--danger);
  border: var(--border-width) solid var(--danger);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-delete:active {
  background-color: #fee2e2;
}

/* Toast Messages */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--border-color);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* Utilities */
.hidden {
  display: none !important;
}

/* City input group in details drawer */
.detail-city-section {
  margin-top: 10px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-city-section label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.city-input-group {
  display: flex;
  gap: 8px;
}

.city-input-group input {
  flex: 1;
  height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
}

.city-input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 2px 2px 0px var(--primary);
}

.btn-save-city {
  height: 38px;
  padding: 0 16px;
  background-color: var(--primary-light);
  color: var(--primary);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 2px 2px 0px #2d241e;
  transition: all 0.1s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-save-city:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #2d241e;
}

.plant-weather-badge {
  background-color: var(--primary-light);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  color: var(--text-primary);
}

.plant-weather-text {
  display: flex;
  align-items: center;
}

.plant-weather-text i {
  margin-right: 6px;
  color: var(--accent-ochre);
}

/* AI Upload Zone styling */
.ai-upload-container {
  border: var(--border-width) dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background-color: var(--card-bg);
  text-align: center;
  position: relative;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.ai-upload-container:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.ai-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.ai-upload-placeholder i {
  font-size: 24px;
  color: var(--primary);
}

.ai-upload-placeholder span {
  font-size: 13px;
  font-weight: 600;
}

.ai-preview-img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--border-color);
  margin-bottom: 8px;
}

/* Loading Overlay for Analysis */
.analysis-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(251, 251, 249, 0.9);
  backdrop-filter: blur(2px);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10;
}

.analysis-overlay i {
  font-size: 28px;
  color: var(--primary);
  animation: spin 1s linear infinite;
}

.analysis-overlay span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* AI Suggestion Box inside exif preview card */
.ai-suggestion-box {
  margin: 12px 0;
  padding: 12px;
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  text-align: left;
}

.ai-suggestion-title {
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.ai-suggestion-content p {
  margin-bottom: 4px;
  color: var(--text-primary);
}

.ai-suggestion-content span {
  font-weight: 600;
}

.ai-apply-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.ai-apply-checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
