/* Region Search Component Styles */
.region-search-container {
  max-width: 720px;
  width: 100%;
  margin: 2rem auto;
  font-family: system-ui, -apple-system, sans-serif;
}

/* Search Box */
.search-box-wrapper {
  position: relative;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-input-group {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.search-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 12px -1px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.search-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px -1px rgba(37, 99, 235, 0.3);
}

/* Input Wrapper for positioning clear button inside */
.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

/* Clear Button - Inside input */
.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.clear-btn.hidden {
  display: none;
}

.dark .clear-btn {
  color: #64748b;
}

.dark .clear-btn:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}

.search-input {
  width: 100%;
  padding: 1rem 3rem 1rem 1.25rem; /* Extra right padding for clear button */
  font-size: 1.1rem;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  background-color: #fff;
  color: #1e293b;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 20px rgba(59, 130, 246, 0.15);
  animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 15px rgba(59, 130, 246, 0.2);
  }
  50% {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 0 25px rgba(59, 130, 246, 0.35);
  }
}

.search-input:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px -1px rgba(59, 130, 246, 0.25);
  animation: none;
}

.search-input::placeholder {
  color: #64748b;
  opacity: 1;
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px -1px rgba(59, 130, 246, 0.2);
}

.search-status {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.5rem;
}

/* Results - Accordion Style */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem; /* Tighter gap for compact list */
}

.result-accordion {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px; /* Slightly smaller radius */
  overflow: hidden;
  transition: all 0.2s ease;
}

.result-accordion:hover {
  border-color: #cbd5e1;
}

.result-accordion[open] {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: #94a3b8;
}

.accordion-summary {
  list-style: none;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: transparent;
  transition: background-color 0.2s;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary:hover {
  background-color: #f8fafc;
}

.summary-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0; /* Prevent flex overflow */
}

.result-name {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.result-accordion[open] .chevron-icon {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid #f1f5f9;
  margin-top: 0;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography & Badges Update */
.result-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px; /* More rectangular/tag-like */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.badge-province { background-color: #dbeafe; color: #1e40af; }
.badge-regency { background-color: #dcfce7; color: #166534; }
.badge-district { background-color: #ffedd5; color: #9a3412; }
.badge-village { background-color: #f3e8ff; color: #6b21a8; }

.hierarchy-tree {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 1rem;
}

.hierarchy-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hierarchy-arrow {
  color: #cbd5e1;
  font-size: 0.8em;
}

/* Data Grid */
.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.data-item {
  display: flex;
  flex-direction: column;
}

.data-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.data-value {
  font-family: monospace;
  font-size: 1rem;
  color: #334155;
  font-weight: 600;
}

/* Actions */
.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn-action {
  appearance: none;
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-action:active {
  transform: translateY(1px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
  font-size: 0.95rem;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background-color: #1e293b;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}

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

/* Skeleton Loader */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-item {
  height: 48px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Validated Icon color */
.text-green-600 { color: #16a34a; }



/* Dark Mode Support (Class Strategy) */
/* This relies on the 'dark' class being present on html/body, matched with tailwind.config.js */

.dark .search-input {
    background-color: #1e293b; /* Slate 800 */
    border-color: #3b82f6; /* Blue 500 - matching light mode */
    color: #f1f5f9; /* Slate 100 */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 0 20px rgba(59, 130, 246, 0.25);
}

.dark .search-input:hover {
    border-color: #60a5fa; /* Blue 400 */
    box-shadow: 0 4px 12px -1px rgba(59, 130, 246, 0.35);
    animation: none;
}

.dark .search-input::placeholder {
    color: #94a3b8; /* Slate 400 - more visible */
}

.dark .result-accordion {
    background-color: #1e293b; /* Slate 800 */
    border-color: #334155; /* Slate 700 */
    box-shadow: none;
}

.dark .result-accordion[open] {
    border-color: #475569;
}

.dark .accordion-summary:hover {
    background-color: #334155; /* Slate 700 */
}

.dark .accordion-body {
    border-top-color: #334155;
}

.dark .result-name {
    color: #f1f5f9; /* Slate 100 */
}

.dark .hierarchy-tree {
    color: #94a3b8; /* Slate 400 */
}

.dark .chevron-icon {
    color: #94a3b8;
}

.dark .data-label {
    color: #64748b; /* Slate 500 */
}

.dark .data-value {
    color: #e2e8f0; /* Slate 200 */
}

.dark .btn-action {
    border-color: #475569; /* Slate 600 */
    color: #cbd5e1; /* Slate 300 */
}

.dark .btn-action:hover {
    background-color: #334155; /* Slate 700 */
    color: #fff;
}

.dark .result-header, 
.dark .data-grid {
    border-color: #334155; 
}

/* Adjusted badge colors for dark mode */
.dark .badge-province { background-color: #1e3a8a; color: #dbeafe; }
.dark .badge-regency { background-color: #14532d; color: #dcfce7; }
.dark .badge-district { background-color: #7c2d12; color: #ffedd5; }
.dark .badge-village { background-color: #581c87; color: #f3e8ff; }

/* Dark mode for skeleton loader */
.dark .skeleton-item {
  background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
  background-size: 200% 100%;
}

/* Dark mode for empty state */
.dark .empty-state {
  color: #94a3b8;
}
