/* Modern Clean Styling for dhiyo */
:root {
  --bg-color: #f7f9fc;
  --surface-color: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --border-color: #e5e7eb;
  --card-radius: 18px;
  --subcard-radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 16px 32px -8px rgba(37, 99, 235, 0.12), 0 4px 12px -2px rgba(0,0,0,0.04);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Views */
.view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.top-bar-spacer {
  width: 44px; /* Matches profile avatar width for perfect centering */
  flex-shrink: 0;
}

.brand {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none;
  text-align: center;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.profile-avatar:hover {
  transform: scale(1.08);
}

.profile-avatar-mini {
  width: 36px;
  height: 36px;
}

/* Location Strip */
.location-strip {
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  padding: 10px 28px;
}

.location-content {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.location-inline-icon {
  width: 17px;
  height: 17px;
  color: var(--primary-blue);
  flex-shrink: 0;
}

#location-text {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-btn-allow {
  background: none;
  border: none;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: var(--transition);
}

.text-btn-allow:hover {
  color: var(--primary-blue-hover);
}

/* Main Cards Grid (Find & Register) */
.boxes-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 10px;
}

.main-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
  aspect-ratio: 1 / 1;
  transition: var(--transition);
  justify-content: space-between;
}

.main-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.sub-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  height: 70%;
}

.sub-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-color);
  border-radius: var(--subcard-radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.sub-card.has-bg-image {
  border-color: rgba(255, 255, 255, 0.2);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.sub-card.has-bg-image .sub-title {
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.8);
}

.sub-card.has-bg-image:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.sub-card:hover {
  background: #eff6ff;
  border-color: var(--primary-blue);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.sub-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-blue);
  background: #dbeafe;
  padding: 3px 8px;
  border-radius: 20px;
}

.sub-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}

/* ==========================================================
   Smooth Search UI Overlay Sheet
========================================================== */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.search-modal-sheet {
  background: #ffffff;
  width: 100%;
  max-width: 820px;
  height: 85vh;
  max-height: 720px;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.search-modal-backdrop.open .search-modal-sheet {
  transform: translateY(0);
}

.search-sheet-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  color: #9ca3af;
  pointer-events: none;
}

#category-search-input {
  width: 100%;
  padding: 13px 40px 13px 44px;
  font-size: 15.5px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: #f9fafb;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

#category-search-input:focus {
  background: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: #e5e7eb;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.clear-search-btn svg {
  width: 12px;
  height: 12px;
  display: block;
}

.clear-search-btn:hover {
  background: #d1d5db;
  color: #111827;
}

.search-close-btn {
  background: #f3f4f6;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  cursor: pointer;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.search-close-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.search-close-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  background: #fdfdfd;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.cat-tab {
  background: #f3f4f6;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.cat-tab:hover {
  background: #e5e7eb;
  color: var(--text-main);
}

.cat-tab.active {
  background: #2563eb;
  color: #ffffff;
}

/* Categories Scroll Area */
.categories-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.category-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-badge-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.count-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 12px;
}

/* Category Chips Grid matching main page (2 per row) */
.chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.search-item-sub-card {
  width: 100%;
  aspect-ratio: 1.3 / 1;
  min-height: 120px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}

.search-item-sub-card:hover {
  background-color: #eff6ff;
  border-color: var(--primary-blue);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.no-results {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

/* Register / Auth Page */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.back-link-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.back-link-btn:hover {
  color: var(--text-main);
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.form-group input,
.form-group select {
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  background: #fdfdfd;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.primary-btn {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 6px;
}

.primary-btn:hover {
  background: var(--primary-blue-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

.login-btn-link {
  background: none;
  border: none;
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-btn-link:hover {
  color: var(--primary-blue-hover);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 400px;
  border-radius: var(--card-radius);
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  animation: fadeIn 0.2s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 720px) {
  .boxes-container {
    grid-template-columns: 1fr;
  }
  .main-card {
    aspect-ratio: auto;
    min-height: 240px;
  }
}
