/* Bottom Drawer Container */
.bottom-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
  z-index: 9998;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.bottom-drawer.open {
  transform: translateY(0);
}

.bottom-drawer.minimized {
  transform: translateY(calc(100% - 60px));
}

/* Drawer Handle */
.drawer-handle {
  width: 100%;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.drawer-handle-bar {
  width: 40px;
  height: 4px;
  background: #d0d0d0;
  border-radius: 2px;
  transition: all 0.3s;
}

.drawer-handle:hover .drawer-handle-bar {
  background: #999;
  width: 50px;
}

/* Drawer Header */
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 2px solid #f0f0f0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  flex-shrink: 0;
}

.drawer-header.rdtr {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.drawer-header.hutan {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.drawer-header.persil {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.drawer-header.sawah {
  background: linear-gradient(135deg, #8BC34A 0%, #CDDC39 100%);
}

.drawer-header.kelerengan {
  background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
}

.drawer-title {
  font-size: 16px;
  font-weight: bold;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.drawer-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.drawer-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.drawer-btn:active {
  transform: scale(0.9);
}

/* Drawer Body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.drawer-body::-webkit-scrollbar {
  width: 6px;
}

.drawer-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.drawer-body::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

/* Data Row */
.data-row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.data-row:last-child {
  border-bottom: none;
}

.data-label {
  font-weight: 600;
  color: #666;
  min-width: 110px;
  flex-shrink: 0;
  font-size: 13px;
}

.data-value {
  color: #333;
  flex: 1;
  font-size: 14px;
  word-wrap: break-word;
}

/* Section */
.drawer-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.drawer-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 15px;
  font-weight: bold;
  font-size: 14px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title.rdtr {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.section-title.hutan {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.section-title.persil {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.section-title.sawah {
  background: linear-gradient(135deg, #8BC34A 0%, #CDDC39 100%);
}

.section-title.kelerengan {
  background: linear-gradient(135deg, #FF9800 0%, #FF5722 100%);
}

/* Navigation */
.drawer-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 10px;
  margin-bottom: 15px;
  gap: 10px;
}

.nav-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.2s;
  min-width: 50px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:active:not(:disabled) {
  background: #5568d3;
  transform: scale(0.95);
}

.nav-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

.nav-info {
  font-weight: bold;
  color: #333;
  font-size: 14px;
  flex: 1;
  text-align: center;
}

/* Overlay backdrop */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Loading & Error States */
.drawer-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.drawer-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.drawer-error {
  color: #d32f2f;
  padding: 15px;
  background: #ffebee;
  border-radius: 8px;
  margin: 10px 0;
  line-height: 1.6;
  font-size: 14px;
}

.drawer-warning {
  color: #f57c00;
  padding: 15px;
  background: #fff3e0;
  border-radius: 8px;
  margin: 10px 0;
  line-height: 1.6;
  font-size: 14px;
  border-left: 4px solid #ff9800;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .bottom-drawer {
    max-height: 40vh;
  }

  .drawer-header {
    padding: 10px 16px;
  }

  .drawer-title {
    font-size: 15px;
  }

  .drawer-body {
    padding: 12px 16px;
  }

  .data-label {
    min-width: 95px;
    font-size: 12px;
  }

  .data-value {
    font-size: 13px;
  }

  .nav-btn {
    min-width: 45px;
    min-height: 45px;
    padding: 10px 15px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .drawer-title {
    font-size: 14px;
  }

  .data-label {
    min-width: 85px;
    font-size: 11px;
  }

  .data-value {
    font-size: 12px;
  }
}

/* Desktop: Show as side panel */
@media (min-width: 1024px) {
  .bottom-drawer {
    bottom: 0;
    left: auto;
    right: 0;
    width: 400px;
    max-height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
  }

  .bottom-drawer.open {
    transform: translateX(0);
  }

  .bottom-drawer.minimized {
    transform: translateX(calc(100% - 60px));
  }

  .drawer-handle {
    display: none;
  }
}