/* ══════════════════════════════════════════════════════════════════
   Public Directory CSS
   ══════════════════════════════════════════════════════════════════ */

.public-dir-body {
  font-family: 'Inter', sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.public-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-img {
  width: 48px;
  height: 48px;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.logo-text p {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.back-login-btn {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.back-login-btn:hover {
  background: #e2e8f0;
}

/* Main Content */
.public-main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
}

/* Search Section */
.search-section {
  text-align: center;
  margin-bottom: 2rem;
}

.search-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: #0f172a;
}

.search-bar-wrapper {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

#dir-search-input {
  width: 100%;
  padding: 1rem 2.5rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#dir-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.clear-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
}

.clear-btn:hover {
  color: #f87171;
}

/* Filter Controls */
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.dir-filter-select {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1 1 180px;
  max-width: 250px;
}

.dir-filter-select:hover, .dir-filter-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

@media (max-width: 768px) {
  .dir-filter-select {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.dir-filter-reset-btn {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 0 0 auto;
}

.dir-filter-reset-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #94a3b8;
}

/* Loading & Error */
.dir-loading, .dir-error {
  text-align: center;
  padding: 4rem 0;
  color: #64748b;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.retry-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 1rem;
  font-weight: 500;
}

/* ── Village Info Cards ── */
.dir-tree-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .dir-tree-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

.village-info-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.village-info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.vic-header {
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.vic-title h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.vic-panchayat {
  font-size: 0.85rem;
  color: #64748b;
  display: block;
}

.vic-badge {
  background: #eff6ff;
  color: #2563eb;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid #bfdbfe;
}

.vic-body {
  padding: 1.5rem;
}

.vic-officers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 480px) {
  .vic-officers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .vic-officers-grid {
    grid-template-columns: 1fr; /* Keep it stacked in 2-col desktop layout */
  }
}

@media (min-width: 1024px) {
  .vic-officers-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.vic-officer-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.highlight-box {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.highlight-box .vic-role {
  color: #166534;
}

.vic-role {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.5px;
}

.vic-loc {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.vic-name {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
}

.vic-badge-no {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 400;
}

.vic-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #2563eb;
  color: #ffffff !important;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.5rem;
  width: fit-content;
  transition: background 0.2s ease;
}

.vic-call-btn:hover {
  background: #1d4ed8;
  text-decoration: none !important;
}

.highlight-box .vic-call-btn {
  background: #16a34a;
}
.highlight-box .vic-call-btn:hover {
  background: #15803d;
}

.vic-empty {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Footer */
.public-footer {
  text-align: center;
  padding: 2rem;
  color: #64748b;
  font-size: 0.85rem;
  border-top: 1px solid #e2e8f0;
  margin-top: auto;
}

.hidden {
  display: none !important;
}

/* Highlighting search text */
.highlight {
  background-color: rgba(250, 204, 21, 0.3);
  color: #fde047;
  padding: 0 2px;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .accordion-body {
    padding: 1rem;
  }
  .header-container {
    flex-direction: column;
    gap: 1rem;
  }
  .search-section h2 {
    font-size: 1.5rem;
  }
  .villages-grid {
    grid-template-columns: 1fr;
  }
}
