/* Punjabi.date - Modern, Fast, Culturally Grounded UI */
/* Material Design 3 Tokens over Beer CSS (ADR-007) */
:root,
body.light {
  --primary: #d9480f;
  --on-primary: #ffffff;
  --primary-container: #ffe8cc;
  --on-primary-container: #4e1200;
  --secondary: #1098ad;
  --on-secondary: #ffffff;
  --secondary-container: #c5f6fa;
  --on-secondary-container: #00363a;
  --tertiary: #f59f00;
  --on-tertiary: #ffffff;
  --tertiary-container: #fff3bf;
  --on-tertiary-container: #3d2400;
  --background: #fdfaf6;
  --on-background: #212529;
  --surface: #ffffff;
  --on-surface: #212529;
  --surface-variant: #f1f3f5;
  --on-surface-variant: #495057;
  --outline: #ced4da;
  --font-icon: none;

  --primary: #d9480f; /* Warm Phulkari Saffron/Orange */
  --primary-hover: #c92a2a;
  --primary-light: #fff4e6;
  --secondary: #1098ad; /* Turquoise Blue */
  --accent: #f59f00; /* Mustard / Gold */
  --bg: #fdfaf6; /* Ivory cream */
  --surface: #ffffff;
  --text: #212529;
  --text-muted: #868e96;
  --border: #e9ecef;
  --radius: 16px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  /* Material Design 3 Tokens over Beer CSS (ADR-007) */
:root,
body.light {
  --primary: #d9480f;
  --on-primary: #ffffff;
  --primary-container: #ffe8cc;
  --on-primary-container: #4e1200;
  --secondary: #1098ad;
  --on-secondary: #ffffff;
  --secondary-container: #c5f6fa;
  --on-secondary-container: #00363a;
  --tertiary: #f59f00;
  --on-tertiary: #ffffff;
  --tertiary-container: #fff3bf;
  --on-tertiary-container: #3d2400;
  --background: #fdfaf6;
  --on-background: #212529;
  --surface: #ffffff;
  --on-surface: #212529;
  --surface-variant: #f1f3f5;
  --on-surface-variant: #495057;
  --outline: #ced4da;
  --font-icon: none;

    --bg: #121316;
    --surface: #1a1b1e;
    --text: #f8f9fa;
    --text-muted: #909296;
    --border: #2c2e33;
    --primary-light: #2c1c14;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 6px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.5);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.container {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  position: relative;
  box-shadow: var(--shadow-sm);
}

/* Header & Nav */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary);
}

.brand-punjabi {
  font-size: 0.95rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

/* Bottom Bar */
nav.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
}

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bottom-tab.active {
  color: var(--primary);
}

/* Card Feed */
.feed-container {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.profile-card.swiping-like {
  box-shadow: 0 16px 36px rgba(43, 138, 62, 0.3), 0 0 0 2px #2b8a3e;
}

.profile-card.swiping-pass {
  box-shadow: 0 16px 36px rgba(224, 49, 49, 0.3), 0 0 0 2px #e03131;
}

.photo-wrapper {
  position: relative;
  height: 380px;
  background: #343a40;
  overflow: hidden;
}

.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-img.blurred {
  filter: blur(24px);
  transform: scale(1.1);
}

.blur-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: 20px;
}

.blur-overlay .badge {
  background: rgba(217, 72, 15, 0.9);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-content {
  padding: 20px;
}

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

.profile-name {
  font-size: 1.45rem;
  font-weight: 700;
}

.profile-location {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 2px;
}

.compat-badge {
  background: #ebfbee;
  color: #2b8a3e;
  border: 1px solid #b2f2bb;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Cultural Badges */
.cultural-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}

.tag-roots {
  background: #e3fafc;
  color: #0c8599;
}

.tag-intent {
  background: #fff3bf;
  color: #d9480f;
}

/* Vichola Endorsement Box */
.vichola-box {
  background: #fff9db;
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  margin: 14px 0;
  color: #5c3b00;
}

.vichola-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #f59f00;
  margin-bottom: 4px;
}

.vichola-quote {
  font-style: italic;
  font-size: 0.9rem;
}

.vichola-author {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
  text-align: right;
}

/* Card Actions */
.card-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px 20px 24px;
}

.action-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-md);
}

.action-btn:hover {
  transform: scale(1.1);
}

.action-btn:active {
  transform: scale(0.95);
}

.btn-pass {
  background: var(--surface);
  color: #fa5252;
  border: 2px solid #ffc9c9;
}

.btn-like {
  background: linear-gradient(135deg, #ff6b6b, #d9480f);
  color: white;
}

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

.match-modal-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.match-modal-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.match-modal-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Forms & Buttons */
.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 8px;
}

/* Chat styles & full-height viewport constraints */
body:has(.chat-window),
html:has(.chat-window),
body.has-chat,
html.has-chat {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

.container:has(.chat-window),
.container.has-chat {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.container:has(.chat-window) header.app-header,
.container.has-chat header.app-header {
  flex-shrink: 0;
}

.container:has(.chat-window) main,
.container.has-chat main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

.chat-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.chat-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  word-break: break-word;
}

.message-bubble.sent {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  align-self: flex-start;
  background: #f1f3f5;
  color: #212529;
  border-bottom-left-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  .message-bubble.received {
    background: #2c2e33;
    color: #f8f9fa;
  }
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* Ensure bottom nav is never shown on chat window */
.container:has(.chat-window) nav.bottom-nav,
.container.has-chat nav.bottom-nav,
.chat-main ~ nav.bottom-nav {
  display: none !important;
}

.chat-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.chat-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 18px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
