@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #fe3c72;
  --primary-hover: #e0285d;
  --secondary: #ff6036;
  --gradient: linear-gradient(135deg, #fe3c72 0%, #ff655b 50%, #ff7854 100%);
  --bg-dark: #0f172a;
  --card-bg: #1e293b;
  --border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

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

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

/* Header */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-icon {
  font-size: 26px;
  -webkit-text-fill-color: initial;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Location Sub-bar (Dải địa chỉ chuẩn hiện đại, rộng rãi, không chèn ép nút) */
.location-subbar {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #1e293b;
  padding: 8px 16px;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 57px;
  z-index: 40;
}

.location-subbar #statusText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92vw;
}

.location-subbar a {
  color: #38bdf8 !important;
  font-weight: 600;
  text-decoration: underline;
  margin-left: 6px;
}

.badge-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 13px;
  color: #38bdf8;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#statusText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-primary {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-secondary:hover {
  background: #334155;
}

/* Location Request Banner */
.location-prompt-bar {
  background: linear-gradient(90deg, #1e1b4b 0%, #172554 100%);
  border-bottom: 1px solid #3b82f6;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.location-prompt-text {
  font-size: 14px;
  color: #bfdbfe;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Container */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  flex: 1;
}

/* Control Panel */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background: #131d31;
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 28px;
  align-items: center;
  justify-content: space-between;
}

.filters-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: #1e293b;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--gradient);
  color: white;
  border-color: transparent;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.slider-group input[type="range"] {
  accent-color: #fe3c72;
  cursor: pointer;
}

/* Profiles Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.profile-card {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.profile-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  border-color: #475569;
}

.card-image-wrap {
  position: relative;
  width: 100%;
  height: 340px;
  overflow: hidden;
  background: #0f172a;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.profile-card:hover .card-image {
  transform: scale(1.04);
}

.distance-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  gap: 4px;
}

.gender-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(254, 60, 114, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(15, 23, 42, 0.95) 100%);
}

.user-name-age {
  font-size: 20px;
  font-weight: 800;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.verified-icon {
  color: #38bdf8;
  font-size: 16px;
}

.card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.user-address {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-bio {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Phone Number Box */
.phone-lock-box {
  margin-top: auto;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed var(--border);
  padding: 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phone-masked-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.phone-masked-number {
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f1f5f9;
}

.phone-unlocked-number {
  font-family: monospace;
  font-size: 16px;
  font-weight: 800;
  color: #10b981;
}

.btn-unlock-phone {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-shadow: 0 4px 14px rgba(254, 60, 114, 0.35);
}

.btn-unlock-phone:hover,
.btn-unlock-phone:active {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 60, 114, 0.5);
}

/* Location Gatekeeper Modern Card */
.location-gatekeeper-card {
  max-width: 520px;
  margin: 40px auto;
  background: #131d31;
  border: 1px solid #334155;
  border-radius: 28px;
  padding: 44px 28px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transition: all 0.3s ease;
}

.gatekeeper-icon-pulse {
  font-size: 64px;
  margin-bottom: 16px;
  display: inline-block;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.location-gatekeeper-card h2 {
  font-size: 24px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.location-gatekeeper-card p {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 28px;
}

.btn-gps-large {
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  justify-content: center;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(254, 60, 114, 0.4);
  transition: all 0.25s ease;
}

.btn-gps-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(254, 60, 114, 0.55);
}

.btn-gps-large:active {
  transform: scale(0.98);
}

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

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

.modal-box {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  padding: 28px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.input-field {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  margin-top: 6px;
  margin-bottom: 16px;
}

.input-field:focus {
  outline: none;
  border-color: #fe3c72;
}

/* Table in Logs Modal */
.table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #334155;
}

th {
  background: #0f172a;
  color: #94a3b8;
  position: sticky;
  top: 0;
}

/* ==============================================================
   RESPONSIVE MOBILE STYLES (Tối ưu hóa hiển thị trên Mobile / Tablet)
   ============================================================== */

@media (max-width: 768px) {
  .container {
    padding: 16px 12px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 640px) {
  /* 1. Header tinh gọn, không bao giờ bị bóp méo chữ */
  .navbar {
    padding: 10px 14px;
    height: 54px;
  }

  .brand {
    font-size: 18px;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .brand-icon {
    font-size: 22px;
  }

  .nav-actions {
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  #btnMyProfile {
    padding: 7px 14px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    border-radius: 9999px !important;
    height: 36px;
  }

  .location-subbar {
    top: 54px;
    padding: 7px 12px;
    font-size: 11.5px;
  }

  /* 2. Location Gatekeeper Card trên Mobile */
  .location-gatekeeper-card {
    margin: 16px auto;
    padding: 30px 18px;
    border-radius: 22px;
  }

  .gatekeeper-icon-pulse {
    font-size: 50px;
    margin-bottom: 12px;
  }

  .location-gatekeeper-card h2 {
    font-size: 20px;
  }

  .location-gatekeeper-card p {
    font-size: 13px;
    margin-bottom: 22px;
  }

  .btn-gps-large {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 14px;
  }

  /* 3. Thanh lọc cuộn ngang mượt mà kiểu Tinder / TikTok tags */
  .control-bar {
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .filters-group {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .filters-group::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    padding: 7px 14px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .slider-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 13px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .slider-group input[type="range"] {
    flex: 1;
    margin-left: 10px;
  }

  /* 4. Thẻ hồ sơ Mobile chuyên nghiệp tỉ lệ chân dung */
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 440px;
    margin: 0 auto;
  }

  .profile-card {
    border-radius: 22px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .card-image-wrap {
    height: 400px;
    border-radius: 22px 22px 0 0;
  }

  .distance-badge {
    top: 12px;
    left: 12px;
    padding: 5px 10px;
    font-size: 11px;
    backdrop-filter: blur(8px);
  }

  .gender-badge {
    top: 12px;
    right: 12px;
    padding: 5px 10px;
    font-size: 11px;
  }

  .card-overlay {
    padding: 24px 16px 12px;
  }

  .user-name-age {
    font-size: 22px;
  }

  .card-content {
    padding: 16px;
    gap: 12px;
  }

  .phone-lock-box {
    padding: 14px;
    border-radius: 14px;
  }

  .phone-masked-number {
    font-size: 16px;
  }

  .btn-unlock-phone {
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 12px;
  }

  /* 5. Modal Bottom Sheet chuẩn trải nghiệm ngón tay cái trên Mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    border-radius: 26px 26px 0 0;
    padding: 28px 20px 32px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    animation: sheetUp 0.28s ease-out;
  }

  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .input-field {
    font-size: 16px !important; /* Ngăn chặn iOS Safari tự phóng to màn hình */
    padding: 14px 16px;
    border-radius: 12px;
  }
}

@media (max-width: 380px) {
  #btnMyProfile .btn-label {
    display: none;
  }

  .brand-title {
    font-size: 16px;
  }

  .card-image-wrap {
    height: 360px;
  }
}
