/* Modern Mobile-First CSS for Travel Agency Outreach Directory */
:root {
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-surface-hover: #374151;
  
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  
  --emerald: #10b981;
  --emerald-light: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.15);
  --rose: #f43f5e;
  --rose-light: rgba(244, 63, 94, 0.15);
  --purple: #8b5cf6;
  --purple-light: rgba(139, 92, 246, 0.15);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Header & Sticky Controls */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 8px;
}

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

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

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.app-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

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

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Search bar */
.search-wrapper {
  position: relative;
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  display: none;
}

.search-clear.active {
  display: block;
}

/* Horizontal Filter Bars */
.filters-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.filter-chip.status-chip[data-status="有意向"].active {
  background: var(--emerald);
  border-color: var(--emerald);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}
.filter-chip.status-chip[data-status="待跟进"].active {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}
.filter-chip.status-chip[data-status="无意向"].active {
  background: var(--rose);
  border-color: var(--rose);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.35);
}

/* Stats Summary Ribbon */
.stats-ribbon {
  max-width: 900px;
  margin: 12px auto 6px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.stats-count {
  color: var(--primary);
  font-weight: 600;
}

/* Agency Cards Stream */
.agency-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agency-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.agency-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow-md);
}

/* Top Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.title-wrap {
  flex: 1;
}

.agency-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.agency-alias {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 2px;
}

.rank-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Tags & Meta row */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.tier-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.tier-1 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.25));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.tier-2 {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.tier-3 {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.tier-4 {
  background: rgba(156, 163, 175, 0.15);
  color: #d1d5db;
  border: 1px solid rgba(156, 163, 175, 0.25);
}

.geo-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.lic-badge {
  font-size: 0.7rem;
  font-family: monospace;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

/* Summary paragraph */
.agency-summary {
  font-size: 0.85rem;
  color: #d1d5db;
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agency-summary.expanded {
  -webkit-line-clamp: unset;
}

/* Address line */
.agency-address {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-bottom: 14px;
}

/* Phone Buttons Section - Core Calling Experience */
.phone-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.phone-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(31, 41, 55, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  transition: all 0.2s;
}

.phone-card:hover {
  background: rgba(55, 65, 81, 0.8);
  border-color: rgba(59, 130, 246, 0.4);
}

.phone-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phone-number {
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  font-feature-settings: "tnum";
}

.phone-label {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.phone-label.area-added {
  color: #60a5fa;
}

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

.call-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
  transition: transform 0.1s, opacity 0.2s;
  min-height: 40px;
}

.call-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.copy-mini-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.copy-mini-btn:hover, .copy-mini-btn:active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Outreach CRM Status Selector */
.card-crm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 6px;
  gap: 8px;
  flex-wrap: wrap;
}

.crm-status-group {
  display: flex;
  gap: 4px;
}

.crm-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.crm-pill.active[data-val="未联系"] {
  background: rgba(156, 163, 175, 0.2);
  color: #e5e7eb;
  border-color: #9ca3af;
}
.crm-pill.active[data-val="有意向"] {
  background: var(--emerald-light);
  color: var(--emerald);
  border-color: var(--emerald);
  font-weight: 600;
}
.crm-pill.active[data-val="待跟进"] {
  background: var(--amber-light);
  color: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}
.crm-pill.active[data-val="无意向"] {
  background: var(--rose-light);
  color: var(--rose);
  border-color: var(--rose);
}

.card-quick-links {
  display: flex;
  gap: 6px;
}

.link-tag {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s;
}

.link-tag:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* Card CRM Note Area */
.crm-note-box {
  width: 100%;
  margin-top: 8px;
  display: none;
}

.crm-note-box.open {
  display: block;
}

.crm-note-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.78rem;
  padding: 6px 10px;
  outline: none;
}

.crm-note-input:focus {
  border-color: var(--primary);
}

/* Toast Message */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(17, 24, 39, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Modal for Export / Help */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.modal-body {
  font-size: 0.86rem;
  color: #d1d5db;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* Desktop optimization */
@media (min-width: 768px) {
  .app-header {
    padding: 16px 24px 12px;
  }
  .agency-container {
    padding: 16px 24px;
    gap: 16px;
  }
  .agency-card {
    padding: 20px;
  }
  .phone-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
