/* ==========================================================================
   Area Calculator Tool - Tool-Specific Styles
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tool Container Layout
   -------------------------------------------------------------------------- */
.tool-container {
  display: flex;
  min-height: 800px;
  background-color: var(--bg);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.tool-sidebar {
  width: 380px;
  background-color: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}

.sidebar-content {
  padding: 20px;
}

.sidebar-content label {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.tool-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.tool-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.tool-section h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Tool Info Box
   -------------------------------------------------------------------------- */
.tool-info {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.tool-item {
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
}

/* --------------------------------------------------------------------------
   Button Groups
   -------------------------------------------------------------------------- */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Results Box
   -------------------------------------------------------------------------- */
.results-box {
  background-color: var(--glass);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid var(--border);
  min-height: 60px;
  font-size: 13px;
  line-height: 1.6;
}

.results-box:empty::before {
  content: "Draw a shape on the map to calculate its area...";
  color: var(--text-muted);
  font-style: italic;
}

.results-box strong {
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Area Results Display
   -------------------------------------------------------------------------- */
.area-result {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.area-result:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.area-result .unit-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.area-result .unit-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.area-result.primary .unit-value {
  font-size: 24px;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   Perimeter Display
   -------------------------------------------------------------------------- */
.perimeter-result {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.perimeter-result .unit-label {
  font-size: 12px;
  color: var(--text-muted);
}

.perimeter-result .unit-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Unit Toggle
   -------------------------------------------------------------------------- */
.unit-toggle {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.unit-toggle button {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-toggle button:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.unit-toggle button:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.unit-toggle button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.unit-toggle button:hover:not(.active) {
  background: var(--hover-bg);
}

/* --------------------------------------------------------------------------
   Shape List
   -------------------------------------------------------------------------- */
.shape-list {
  margin-top: 12px;
}

.shape-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
}

.shape-item:last-child {
  margin-bottom: 0;
}

.shape-item .shape-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shape-item .shape-icon {
  font-size: 18px;
}

.shape-item .shape-details {
  font-size: 13px;
}

.shape-item .shape-name {
  font-weight: 600;
  color: var(--text);
}

.shape-item .shape-area {
  color: var(--text-muted);
  font-size: 12px;
}

.shape-item .btn-delete {
  padding: 4px 8px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.shape-item .btn-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* --------------------------------------------------------------------------
   Map Container
   -------------------------------------------------------------------------- */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 800px;
}

.map {
  width: 100%;
  height: 100%;
}

#map .leaflet-container {
  width: 100% !important;
  height: 100% !important;
}

/* --------------------------------------------------------------------------
   Leaflet Draw Overrides
   -------------------------------------------------------------------------- */
.leaflet-draw-toolbar a {
  background-color: var(--card) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

.leaflet-draw-toolbar a:hover {
  background-color: var(--hover-bg) !important;
}

.leaflet-draw-actions {
  background-color: var(--card) !important;
  border-color: var(--border) !important;
}

.leaflet-draw-actions a {
  background-color: var(--card) !important;
  color: var(--text) !important;
}

.leaflet-draw-actions a:hover {
  background-color: var(--hover-bg) !important;
}

/* --------------------------------------------------------------------------
   Mobile FAB
   -------------------------------------------------------------------------- */
.fab {
  display: none;
  width: 56px;
  height: 56px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 9999;
}

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .tool-container {
    flex-direction: column;
    height: calc(100vh - 250px);
  }

  .tool-sidebar {
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    transition: max-height 0.3s ease;
  }

  .tool-sidebar.collapsed {
    max-height: 0;
    overflow: hidden;
  }

  .map-container {
    flex: 1;
  }

  .fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
  }
}

@media (max-width: 600px) {
  .sidebar-content {
    padding: 16px;
  }

  .tool-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
  }

  .map-container {
    min-height: 400px;
  }
}
