/* public/style.css */
* {
  box-sizing: border-box;
}
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #d1d5db;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.toolbar-btn:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
  color: #fff;
}
.toolbar-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}
.toolbar-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: #9ca3af;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.toolbar-btn-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sidebar-section {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.75rem;
}
.sidebar-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-label {
  font-size: 0.6875rem;
  color: #6b7280;
  font-weight: 500;
}
.sidebar-input {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  background: #0f1117;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  font-size: 0.75rem;
  font-family:
    "Inter",
    system-ui,
    sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
}
.sidebar-input:focus {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
}
.sidebar-input::-webkit-inner-spin-button,
.sidebar-input::-webkit-outer-spin-button {
  opacity: 0.3;
}
.readout-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}
.readout-label {
  font-size: 0.6875rem;
  color: #6b7280;
}
.readout-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: #e5e7eb;
  font-variant-numeric: tabular-nums;
}
#canvas2d {
  cursor: crosshair;
}
#canvas3d canvas {
  width: 100% !important;
  height: 100% !important;
}
#status-bar {
  pointer-events: none;
  user-select: none;
}
@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}
.collision-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
}
.collision-badge.ok {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.collision-badge.collision {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.pressure-ok {
  color: #3b82f6;
}
.pressure-failure {
  color: #f97316;
}
.canvas-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(26, 29, 39, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.6875rem;
  color: #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.canvas-tooltip.visible {
  opacity: 1;
}
#global-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background-color: #0b0f17;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}
#global-loader.fade-out {
  opacity: 0;
  visibility: hidden;
}
.loader-icon-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loader-orbit-1 {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: rgba(34, 197, 94, 0.8);
  border-bottom-color: rgba(34, 197, 94, 0.8);
  border-radius: 50%;
  animation: spin 3s linear infinite;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}
.loader-orbit-2 {
  position: absolute;
  inset: 15px;
  border: 2px solid transparent;
  border-left-color: rgba(6, 182, 212, 0.8);
  border-right-color: rgba(6, 182, 212, 0.8);
  border-radius: 50%;
  animation: spin 2s linear infinite reverse;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}
.loader-orbit-3 {
  position: absolute;
  inset: 30px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: spin 10s linear infinite;
}
.loader-icon-text {
  font-family: "Noto Serif Tamil", serif;
  font-size: 4.5rem;
  font-weight: 700;
  background:
    linear-gradient(
      135deg,
      #34d399 0%,
      #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.5));
  animation: pulse-glow 2s ease-in-out infinite;
  margin-top: -10px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse-glow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.4));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 30px rgba(6, 182, 212, 0.8));
    transform: scale(1.08);
  }
}
.home-tree-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(6, 1fr);
  width: 100%;
  height: 100%;
  gap: 1px;
  padding: 1rem;
}
.home-tree-cell {
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: 2px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}
.home-tree-cell:hover {
  background: rgba(255, 255, 255, 0.05);
}
.home-tree-dot {
  width: 0;
  height: 0;
  opacity: 0;
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 10.5V8A5 5 0 0 0 7 8v2.5A5 5 0 0 0 9.5 20H11v4h2v-4h1.5A5 5 0 0 0 17 10.5z" /></svg>');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: bottom center;
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M17 10.5V8A5 5 0 0 0 7 8v2.5A5 5 0 0 0 9.5 20H11v4h2v-4h1.5A5 5 0 0 0 17 10.5z" /></svg>');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: bottom center;
  transform-origin: bottom center;
}
.home-tree-dot.plant-1 {
  background:
    linear-gradient(
      to top,
      #065f46 0%,
      #34d399 100%);
  filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.4));
  animation: grow-tree 4s ease-out infinite alternate;
}
.home-tree-dot.plant-2 {
  background:
    linear-gradient(
      to top,
      #0891b2 0%,
      #22d3ee 100%);
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.4));
  animation: grow-tree 4.5s ease-out infinite alternate;
}
.home-tree-dot.plant-3 {
  background:
    linear-gradient(
      to top,
      #b45309 0%,
      #fbbf24 100%);
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.4));
  animation: grow-tree 3.5s ease-out infinite alternate;
}
@keyframes grow-tree {
  0% {
    width: 0;
    height: 0;
    opacity: 0;
    transform: scaleY(0);
  }
  10% {
    opacity: 1;
  }
  100% {
    width: 80%;
    height: 80%;
    opacity: 0.95;
    transform: scaleY(1);
  }
}
.glass-panel {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
@media (max-width: 768px) {
  #toolbar .toolbar-btn span {
    display: none;
  }
  #toolbar .toolbar-btn {
    padding: 0.375rem;
    gap: 0;
  }
  #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    width: 85vw;
  }
  #sidebar.open {
    transform: translateX(100%);
  }
  #modal-settings,
  #modal-tree-manager,
  #modal-tree-detail,
  #modal-tree-studio,
  #modal-tree-dashboard,
  #help-modal {
    align-items: flex-end !important;
  }
  #modal-settings > div,
  #modal-tree-manager > div,
  #modal-tree-detail > div,
  #modal-tree-studio > div,
  #modal-tree-dashboard > div,
  #help-modal > div {
    width: 100% !important;
    max-width: none !important;
    border-radius: 1.5rem 1.5rem 0 0 !important;
    height: 85vh !important;
  }
  #status-bar {
    bottom: env(safe-area-inset-bottom, 1rem);
    width: calc(100% - 2rem);
    left: 50%;
    transform: translateX(-50%);
  }
  .toolbar-btn,
  .toolbar-btn-icon,
  button {
    min-width: 44px;
    min-height: 44px;
  }
}
@media (max-width: 640px) {
  #toolbar {
    padding: 0.5rem;
  }
}
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}
@media (max-height: 500px) and (orientation: landscape) {
  #toolbar {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  #sidebar {
    width: 60vw !important;
    max-width: 280px;
  }
  #modal-settings > div,
  #modal-tree-manager > div,
  #modal-tree-detail > div,
  #modal-tree-studio > div,
  #modal-tree-dashboard > div,
  #help-modal > div {
    height: 90vh !important;
  }
  #global-loader p {
    display: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) and (max-width: 900px) {
  #modal-tree-studio > div {
    height: 95vh !important;
    border-radius: 0.75rem !important;
  }
  #status-bar {
    bottom: max(env(safe-area-inset-bottom), 0.5rem);
  }
}
@keyframes banner-slide-up {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#pwa-install-banner:not(.hidden) {
  animation: banner-slide-up 0.35s ease-out;
}
