/* contacts.css — SSMM Public Mobile-First Directory Styling */

:root {
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --card-border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --text-main: #0F172A;
  --text-sub: #475569;
  --text-dim: #94A3B8;
  --primary-accent: #7C3AED;
  --primary-hover: #6D28D9;
  --primary-light: #EDE9FE;
  --success-color: #10B981;
  --success-light: #D1FAE5;
  --warning-color: #F59E0B;
  --warning-light: #FEF3C7;
  --danger-color: #EF4444;
  --danger-light: #FEE2E2;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg-color: #0F172A;
  --card-bg: #1E293B;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --text-main: #F8FAFC;
  --text-sub: #CBD5E1;
  --text-dim: #64748B;
  --primary-accent: #A78BFA;
  --primary-hover: #8B5CF6;
  --primary-light: rgba(167, 139, 250, 0.15);
  --success-color: #34D399;
  --success-light: rgba(52, 211, 153, 0.15);
  --warning-color: #FBBF24;
  --warning-light: rgba(251, 191, 36, 0.15);
  --danger-color: #F87171;
  --danger-light: rgba(248, 113, 113, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.directory-app {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-color);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
}

/* ── Sticky Top Bar ───────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.header-title-box {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-sub);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary-accent);
}

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-accent);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--card-border);
  cursor: pointer;
}

.user-avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* ── Sticky Search & Filter Row ────────────────────── */
.search-filter-row {
  padding: 8px 16px 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  font-size: 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--bg-color);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary-accent);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  display: none;
}

.filter-toggle-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-toggle-btn.has-filters {
  border-color: var(--primary-accent);
  color: var(--primary-accent);
  background: var(--primary-light);
}

.filter-badge-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  background: var(--primary-accent);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
  display: none;
}

.filter-toggle-btn.has-filters .filter-badge-dot {
  display: block;
}

/* ── Notification Banner (Submitter Result) ────────── */
.submitter-notify-banner {
  margin: 12px 16px 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.4;
  animation: slideDown 0.3s ease;
}

.submitter-notify-banner.approved {
  background: var(--success-light);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.submitter-notify-banner.rejected {
  background: var(--warning-light);
  color: #92400E;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.notify-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.notify-close-btn:hover {
  opacity: 1;
}

/* ── Active Filter Chips Row ──────────────────────── */
.active-filters-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 8px 16px;
  overflow-x: auto;
  white-space: nowrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-accent);
  font-size: 11px;
  font-weight: 600;
}

.filter-chip-remove {
  cursor: pointer;
  font-weight: bold;
}

/* ── Directory Meta Bar ────────────────────────────── */
.directory-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Contact Phonebook List ────────────────────────── */
.contact-list-container {
  flex: 1;
  padding: 0 16px 90px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.contact-card-row:active {
  transform: scale(0.985);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #FFFFFF;
  flex-shrink: 0;
  text-transform: uppercase;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-firm {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.contact-badge-mini {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-accent);
  margin-left: 6px;
}

.contact-chevron {
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Pagination / Load More ───────────────────────── */
.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 16px 0 24px 0;
}

.btn-load-more {
  padding: 10px 24px;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-load-more:hover {
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

/* ── Empty & Skeleton States ──────────────────────── */
.empty-directory-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* ── Floating Action Button (+ Add New) ───────────── */
.fab-add-contact {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  right: max(20px, calc(50% - 300px));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--primary-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab-add-contact:active {
  transform: scale(0.96);
}

/* ── Modals & Bottom Sheets ───────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet-card {
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  background: var(--card-bg);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: calc(16px + var(--safe-bottom));
}

.modal-overlay.active .bottom-sheet-card {
  transform: translateY(0);
}

.sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--text-dim);
  opacity: 0.4;
  border-radius: 2px;
  margin: 10px auto 4px auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--card-border);
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.sheet-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-dim);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.sheet-close-btn:hover {
  background: var(--primary-light);
  color: var(--primary-accent);
}

.sheet-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── Contact Detail Sheet Specifics ───────────────── */
.detail-header-block {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-avatar-large {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.detail-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.detail-firm {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 2px;
}

.detail-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.detail-tag {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.detail-tag.badge-tag {
  background: var(--primary-light);
  color: var(--primary-accent);
}

.detail-tag.referral-tag {
  background: #E0F2FE;
  color: #0369A1;
}

.detail-tag.area-tag {
  background: #FEF3C7;
  color: #92400E;
}

.detail-tag.delivery-tag {
  background: #F1F5F9;
  color: #475569;
}

.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin: 16px 0 8px 0;
}

/* ── Action Buttons for Phones & Addresses ────────── */
.phone-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.phone-number-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.phone-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-contact-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-contact-action.call {
  background: #DCFCE7;
  color: #166534;
}

.btn-contact-action.whatsapp {
  background: #D1FAE5;
  color: #047857;
}

.btn-contact-action.copy {
  background: var(--primary-light);
  color: var(--primary-accent);
}

.address-box-card {
  padding: 12px 14px;
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.address-text {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
  line-height: 1.4;
}

.address-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Bottom Sheet Action Footer ───────────────────── */
.sheet-action-footer {
  padding: 12px 20px 0 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  gap: 10px;
}

.btn-sheet-secondary {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-sheet-primary {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--primary-accent);
  border: none;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Forms (New Contact & Request Edit) ───────────── */
.form-group-item {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.form-input-text, .form-select-native, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-color);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.form-input-text:focus, .form-select-native:focus, .form-textarea:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chips-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--bg-color);
  min-height: 44px;
  align-items: center;
}

.chip-phone-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--primary-light);
  color: var(--primary-accent);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.chip-phone-tag .chip-del {
  cursor: pointer;
  font-weight: bold;
}

.chips-native-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  flex: 1;
  min-width: 130px;
  color: var(--text-main);
}

/* Multi-checkbox grid */
.checkbox-pills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-pill-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.checkbox-pill-label input[type="checkbox"] {
  accent-color: var(--primary-accent);
}

.checkbox-pill-label:has(input:checked) {
  background: var(--primary-light);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

/* ── Google Auth Card Center Modal ────────────────── */
.auth-center-modal {
  width: 90%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  margin: auto;
}

.google-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #1E293B;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
  margin-top: 20px;
}

.google-auth-btn:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Toast Container */
.public-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.public-toast {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: var(--text-main);
  color: var(--bg-color);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.2s ease;
}

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

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