/* ===== CSS Custom Properties ===== */
:root {
  --primary: #818CF8;
  --primary-light: #A5B4FC;
  --primary-dark: #6366F1;
  --secondary: #22D3EE;
  --secondary-light: #67E8F9;
  --bg: #0F172A;
  --text: #E2E8F0;
  --text-light: #94A3B8;
  --border: #1E293B;
  --card-bg: #1E293B;
  --success: #34D399;
  --error: #F87171;
  --warning: #FBBF24;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.2);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --nav-height: 64px;
  --transition: 0.2s ease;
}

/* ===== Reset / Normalize ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  padding-top: var(--nav-height);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul, ol { list-style: none; }
input, select, textarea, button { font: inherit; }

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

.navbar-brand img {
  height: 32px;
  width: auto;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-links a {
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color var(--transition);
  white-space: nowrap;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--primary);
}

.navbar-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.navbar-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform var(--transition), opacity var(--transition);
  border-radius: 2px;
}

.navbar-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active span:nth-child(2) {
  opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  color: var(--text);
}

.card-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  border-color: #DC2626;
  color: #fff;
}

.btn-google {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 0.625rem 1.5rem;
}

.btn-google:hover:not(:disabled) {
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--text);
}

.btn-google img {
  width: 18px;
  height: 18px;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

.form-label .required {
  color: var(--error);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #94A3B8;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  margin-top: 0.25rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-check-label {
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.form-check-detail {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  margin-left: 1.5rem;
}

.form-radio-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.form-radio-card {
  flex: 1;
  min-width: 140px;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.form-radio-card:hover {
  border-color: var(--primary-light);
}

.form-radio-card.selected {
  border-color: var(--primary);
  background: rgba(129, 140, 248, 0.1);
}

.form-radio-card input {
  display: none;
}

/* ===== Tags / Chips ===== */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
  background: var(--card-bg);
  cursor: text;
}

.chips-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: rgba(129, 140, 248, 0.2);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.chip-remove {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.7;
  background: none;
  border: none;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
}

.chip-remove:hover {
  opacity: 1;
}

.chips-input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 120px;
  padding: 0.25rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text);
}

/* ===== Badges / Labels ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(129, 140, 248, 0.2);
  color: var(--primary);
}

.badge-secondary {
  background: rgba(34, 211, 238, 0.15);
  color: var(--secondary);
}

.badge-success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.badge-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.badge-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-light);
}

.badge-intent {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

/* ===== My Searches Page ===== */
.my-searches {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.my-searches .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.searches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.search-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-stat {
  font-size: 0.8rem;
  color: var(--text-light);
}

.search-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.inline-form {
  display: inline;
}

/* ===== Search Form ===== */
.form-page {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.search-form .form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.alert-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 113, 113, 0.3);
  margin-bottom: 1.5rem;
}

.tags-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--card-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  cursor: text;
}

.tags-editor:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tags-input {
  border: none !important;
  box-shadow: none !important;
  padding: 0.25rem 0.5rem !important;
  min-width: 120px;
  flex: 1;
  background: transparent !important;
}

.chip-editable {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: rgba(129, 140, 248, 0.2);
  border: 1px solid rgba(129, 140, 248, 0.3);
  border-radius: 1rem;
  color: var(--primary-light);
}

.chip-remove {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.chip-remove:hover {
  color: var(--error);
}

.intent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.intent-option {
  cursor: pointer;
}

.intent-option input {
  display: none;
}

.intent-label {
  display: block;
  padding: 0.625rem 1rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}

.intent-option input:checked + .intent-label {
  background: rgba(129, 140, 248, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.intent-option:hover .intent-label {
  border-color: var(--primary-light);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(129, 140, 248, 0.06);
}

.radio-content small {
  color: var(--text-light);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .intent-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Upload Page ===== */
.upload-page {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.upload-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.upload-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-light);
  margin-top: 1.5rem;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(129, 140, 248, 0.08);
  color: var(--primary);
}

.upload-dropzone svg {
  margin: 0 auto 1rem;
  display: block;
}

.upload-dropzone p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.upload-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.upload-preview {
  margin-top: 1.5rem;
  text-align: center;
}

.upload-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.upload-preview-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.upload-result {
  text-align: center;
}

.upload-result h2 {
  color: var(--success);
  margin-bottom: 1rem;
}

.upload-result-image {
  margin-bottom: 1.5rem;
}

.upload-result-image img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
}

.upload-url-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.upload-url-box .form-input {
  flex: 1;
  font-size: 0.85rem;
  font-family: monospace;
}

/* ===== Flash Messages ===== */
.flash {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: flashIn 0.3s ease;
}

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

.flash-success {
  background: rgba(52, 211, 153, 0.15);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.flash-error {
  background: rgba(248, 113, 113, 0.15);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-warning {
  background: rgba(251, 191, 36, 0.15);
  color: #92400E;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.flash-info {
  background: rgba(129, 140, 248, 0.2);
  color: #3730A3;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.flash-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.6;
  color: inherit;
  padding: 0;
  line-height: 1;
}

.flash-close:hover {
  opacity: 1;
}

/* ===== Chat Layout ===== */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--card-bg);
  overflow-y: auto;
}

.chat-sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-conversation-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.chat-conversation-item:hover {
  background: var(--bg);
}

.chat-conversation-item.active {
  background: rgba(129, 140, 248, 0.12);
  border-left: 3px solid var(--primary);
}

.chat-conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

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

.chat-conversation-name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-preview {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-unread-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-width: 0;
}

.chat-header {
  padding: 0.875rem 1.25rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-status {
  font-size: 0.8rem;
  color: var(--text-light);
}

.chat-status.online {
  color: var(--success);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

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

.chat-message-received {
  align-self: flex-start;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-message-bot {
  align-self: flex-start;
  background: rgba(34, 211, 238, 0.15);
  color: var(--text);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-bottom-left-radius: 4px;
}

.chat-message-time {
  font-size: 0.7rem;
  margin-top: 0.25rem;
  opacity: 0.7;
}

.chat-message-sent .chat-message-time {
  text-align: right;
}

.chat-typing {
  font-size: 0.8rem;
  color: var(--text-light);
  padding: 0.5rem 1.25rem;
  font-style: italic;
}

.chat-input-area {
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.chat-input-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chat-input-form input {
  flex: 1;
}

.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 1rem;
}

/* ===== Dashboard Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ===== Image Upload Preview ===== */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
}

.image-upload-area:hover {
  border-color: var(--primary-light);
  background: rgba(129, 140, 248, 0.06);
}

.image-upload-area.has-image {
  border-style: solid;
  padding: 0.5rem;
}

.image-upload-preview {
  max-width: 300px;
  max-height: 300px;
  margin: 0 auto;
  border-radius: var(--radius);
  object-fit: cover;
}

.image-upload-text {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ===== Language Switcher ===== */
.lang-switcher {
  position: relative;
}

.lang-switcher-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: all var(--transition);
}

.lang-switcher-btn:hover {
  border-color: var(--primary-light);
}

.lang-switcher-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  z-index: 1001;
  display: none;
  overflow: hidden;
}

.lang-switcher-dropdown.open {
  display: block;
}

.lang-switcher-dropdown a {
  display: block;
  padding: 0.5rem 0.875rem;
  color: var(--text);
  font-size: 0.85rem;
  transition: background var(--transition);
}

.lang-switcher-dropdown a:hover {
  background: var(--bg);
  color: var(--primary);
}

.lang-switcher-dropdown a.active {
  color: var(--primary);
  font-weight: 600;
}

/* ===== Cookie Banner ===== */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 1002;
  animation: slideUp 0.3s ease;
}

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

.cookie-banner-text {
  font-size: 0.9rem;
  color: var(--text);
  flex: 1;
}

.cookie-banner-text a {
  color: var(--primary);
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.cookie-banner.hidden {
  display: none;
}

/* ===== Landing Page ===== */
.hero {
  padding: 4rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 3rem;
}

.hero-text {
  flex: 1;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.hero-search {
  margin-bottom: 1.5rem;
}

.hero-search-box {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.25rem 0.25rem 0.25rem 1rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hero-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
}

.hero-search-icon {
  color: var(--text-light);
  flex-shrink: 0;
}

.hero-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.75rem;
  font-size: 1rem;
  background: transparent;
  color: var(--text);
}

.hero-search-input::placeholder {
  color: #94A3B8;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

.hero-visual {
  flex-shrink: 0;
}

.hero-logo {
  width: 200px;
  height: 200px;
  opacity: 0.9;
}

.features {
  padding: 4rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.feature-icon {
  color: var(--primary);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
}

.cta-section {
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.cta-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.cta-section p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
}

.recent-searches {
  padding: 3rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.recent-searches-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.recent-searches-header .section-title {
  margin-bottom: 0;
}

.search-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow var(--transition), transform var(--transition);
}

.search-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.search-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.search-card-username {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
}

.badge-intent {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(129, 140, 248, 0.2);
  color: var(--primary);
  border-radius: 1rem;
}

.search-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.search-card-bio {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

.search-card-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.chip {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  color: var(--text);
}

.chip-sm {
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

.chip-more {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

.search-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.search-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.5rem;
}

.search-card-location {
  font-size: 0.8rem;
  color: var(--text-light);
}

.search-card-date {
  font-size: 0.75rem;
  color: var(--text-light);
}

.search-card-owner {
  font-size: 0.8rem;
}

.search-card-by {
  color: var(--text-light);
}

@media (max-width: 768px) {
  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-logo {
    width: 120px;
    height: 120px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .recent-searches-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* ===== Discover Page ===== */
.discover {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.filter-bar {
  margin-bottom: 2rem;
}

.filter-form .filter-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-search {
  flex: 2;
  min-width: 200px;
}

.filter-logic {
  flex-shrink: 0;
}

.filter-intent,
.filter-location {
  flex: 1;
  min-width: 140px;
}

.toggle-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toggle-option {
  cursor: pointer;
}

.toggle-option input {
  display: none;
}

.toggle-label {
  display: block;
  padding: 0.625rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}

.toggle-option input:checked + .toggle-label {
  background: var(--primary);
  color: #fff;
}

.toggle-sm .toggle-label {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.search-card-actions {
  display: flex;
  gap: 0.5rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ===== Profile Page ===== */
.profile-page {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}

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

.profile-username {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.profile-title {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.badge-lg {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.profile-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.profile-bio {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
}

.profile-interests {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-details {
  display: grid;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  gap: 1rem;
}

.detail-row dt {
  font-weight: 500;
  color: var(--text-light);
  min-width: 100px;
}

.detail-row dd {
  color: var(--text);
}

.profile-actions {
  margin-top: 1.5rem;
}

.approach-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.approach-form-row .form-select {
  flex: 1;
}

.approach-disabled {
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.profile-legal {
  text-align: center;
  padding: 1.25rem 0 0;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.profile-legal a {
  color: var(--text-light);
}

.profile-legal a:hover {
  color: var(--primary);
}

.profile-legal-sep {
  margin: 0 0.5rem;
}

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 1rem;
}

/* ===== Auth Pages ===== */
.auth-container {
  max-width: 440px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid var(--border);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* ===== Consent Page ===== */
.consent-section {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.consent-section-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ===== Character Counter ===== */
.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.danger {
  color: var(--error);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  max-width: 400px;
  margin: 0 auto 1.5rem;
  font-size: 0.9rem;
}

/* ===== Match Card ===== */
.match-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.match-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ===== Confirm Dialog ===== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-dialog {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.confirm-dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.confirm-dialog-text {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }

/* ===== RTL Support ===== */
[dir="rtl"] body {
  text-align: right;
}

[dir="rtl"] .navbar-links {
  direction: rtl;
}

[dir="rtl"] .chat-conversation-item.active {
  border-left: none;
  border-right: 3px solid var(--primary);
}

[dir="rtl"] .chat-message-sent {
  border-bottom-right-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
}

[dir="rtl"] .chat-message-received,
[dir="rtl"] .chat-message-bot {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: 4px;
}

[dir="rtl"] .chat-message-sent .chat-message-time {
  text-align: left;
}

[dir="rtl"] .form-select {
  background-position: left 0.75rem center;
  padding-right: 0.875rem;
  padding-left: 2.5rem;
}

[dir="rtl"] .form-check-detail {
  margin-left: 0;
  margin-right: 1.5rem;
}

[dir="rtl"] .char-counter {
  text-align: left;
}

[dir="rtl"] .lang-switcher-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .confirm-dialog-actions {
  justify-content: flex-start;
}

[dir="rtl"] .flash {
  direction: rtl;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .navbar-links,
  .navbar-auth {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-md);
  }

  .navbar-links.open,
  .navbar-auth.open {
    display: flex;
  }

  .navbar-auth {
    top: auto;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
  }

  .navbar-toggle {
    display: block;
  }

  .chat-layout {
    flex-direction: column;
  }

  .chat-sidebar {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chat-message {
    max-width: 85%;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cookie-banner {
    flex-direction: column;
    text-align: center;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .form-radio-group {
    flex-direction: column;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chat-sidebar {
    width: 280px;
  }
}

/* ===== Print ===== */
@media print {
  .navbar,
  .cookie-banner,
  .navbar-toggle,
  .btn,
  .chat-input-area,
  .lang-switcher {
    display: none !important;
  }

  body {
    padding-top: 0;
    background: #fff;
    color: #000;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .container {
    max-width: 100%;
  }
}
