/* Flathunter - Earth Tones Theme */
/* Warm, calm design for apartment hunting */

:root {
  --bg-primary: #2d3436;
  --bg-secondary: #636e72;
  --accent: #fdcb6e;
  --accent-hover: #f9b234;
  --card-bg: rgba(253, 203, 110, 0.08);
  --card-hover: rgba(253, 203, 110, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #b2bec3;
  --success: #00b894;
  --danger: #d63031;
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  min-height: 100vh;
  font-family: 'Nunito', 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  color: var(--text-primary);
  margin: 0;
  padding: 0;
}

/* Navigation */
.navbar {
  background: rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(253, 203, 110, 0.1);
}

.navbar-brand {
  font-weight: 700;
  color: var(--accent) !important;
  font-size: 1.4rem;
}

.nav-link {
  color: var(--text-primary) !important;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent) !important;
}

/* Typography */
h1, h2, h3 {
  color: var(--text-primary);
  font-weight: 600;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

h2 {
  font-size: 1.5rem;
  color: var(--accent);
}

a, a:visited {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Intro Section */
.intro {
  text-align: center;
  padding: 2rem 0;
}

.intro p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto 1.5rem;
}

/* Search Config Display */
.search-config {
  background: var(--card-bg);
  border: 1px solid rgba(253, 203, 110, 0.2);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.search-config h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-config .config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.search-config .config-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.search-config .config-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-config .config-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Filter Form */
.search_form {
  background: var(--card-bg);
  border: 1px solid rgba(253, 203, 110, 0.2);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.form-control {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(253, 203, 110, 0.2);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
}

.form-control:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(253, 203, 110, 0.1);
  color: var(--text-primary);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-secondary);
}

form label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Buttons */
button, .btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button.primary, .btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

button.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(253, 203, 110, 0.3);
}

button.secondary, .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

button.secondary:hover, .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

button.success, .btn-success {
  background: var(--success);
  color: white;
}

button.success:hover, .btn-success:hover {
  background: #00a383;
}

button.danger, .btn-danger {
  background: var(--danger);
  color: white;
}

button.danger:hover, .btn-danger:hover {
  background: #c0392b;
}

.center_button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* Legacy button classes */
.set_search_criteria {
  background: var(--accent);
  color: var(--bg-primary);
}

.toggle_notification.enabled {
  background: var(--danger);
}

.toggle_notification.disabled {
  background: var(--success);
}

.login_telegram {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Expose Cards */
.exposes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.expose {
  background: var(--card-bg);
  border: 1px solid rgba(253, 203, 110, 0.1);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  text-decoration: none;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.expose:hover {
  background: var(--card-hover);
  border-color: rgba(253, 203, 110, 0.3);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  text-decoration: none;
}

.expose img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
}

.expose h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}

.expose p {
  font-size: 0.9rem;
  color: var(--accent);
  margin: 0;
  font-weight: 500;
}

.expose .expose-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Status Section */
.status-section {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.status-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.status-text span {
  color: var(--text-primary);
  font-weight: 500;
}

/* Settings Page */
.settings-section {
  background: var(--card-bg);
  border: 1px solid rgba(253, 203, 110, 0.2);
  border-radius: var(--border-radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.settings-section h3 {
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(253, 203, 110, 0.2);
}

.settings-section .help-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.settings-section .help-link {
  color: var(--accent);
  font-weight: 500;
}

.notification-option {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.notification-option label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.notification-option .option-fields {
  margin-top: 1rem;
  padding-left: 2rem;
}

/* Alert Messages */
.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
}

.alert-success {
  background: rgba(0, 184, 148, 0.2);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-error {
  background: rgba(214, 48, 49, 0.2);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
  border-top: 1px solid rgba(253, 203, 110, 0.1);
}

footer p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

footer img {
  height: 20px;
  margin: 0 5px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

footer img:hover {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .exposes {
    grid-template-columns: 1fr;
  }

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

  .center_button {
    flex-direction: column;
  }

  button, .btn {
    width: 100%;
  }
}

/* Utility classes */
.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; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }

/* Hunt button (legacy) */
.hunt-button {
  background: var(--accent);
  color: var(--bg-primary);
  height: auto;
  padding: 0.75rem 2rem;
  font-weight: 600;
  border-radius: 25px;
}

.hunt-button:hover {
  background: var(--accent-hover);
}

.hunt-button.disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
}

.button-holder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

/* Telegram icon (keep for compatibility) */
i.telegram_icon {
  background: url('data:image/svg+xml,%3Csvg%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m1.95617055%2011.392196c5.77764656-2.42328736%209.63031585-4.02086673%2011.55800785-4.79273807%205.5039525-2.20384954%206.6476266-2.5866818%207.3930574-2.59932314.1639507-.00278035.5305319.0363352.7679878.22182361.2005031.15662277.2556695.36819788.2820684.51669348.026399.1484956.0592719.48677234.0331404.75109194-.2982611%203.0169019-1.5888322%2010.33812718-2.2454015%2013.71710898-.2778191%201.4297738-.8288514%201.7357846-1.3584441%201.7826999-1.1509274.1019576-2.0208916-.5588425-3.1356211-1.2622918-1.7443316-1.1007592-2.3854935-1.3972358-4.0786694-2.4713734-1.95675765-1.2413519-.8891962-1.8911034.2259543-3.0061212.2918402-.2918054%205.3989024-4.83750096%205.497052-5.24030969.0122753-.05037796-.1557336-.55407742-.2716182-.65323489-.1158847-.09915747-.2869204-.06524947-.4103446-.03828214-.17495.03822537-2.9615423%201.81132342-8.35977698%205.31929412-.79096496.5228681-1.50739646.7776269-2.1492945.7642766-.70764107-.0147176-2.06885864-.3851791-3.08078398-.7018404-1.24116762-.388398-1.69932554-.5713149-1.61342745-1.2309348.04474105-.3435709.36011227-.7024173.94611366-1.0765391z%22%20fill%3D%22%23fff%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E') no-repeat 0 -1px;
  width: 24px;
  height: 22px;
  margin: 0px 13px -2px -7px;
  display: inline-block;
}

/* ===========================
   Table View for Listings
   =========================== */

.table-responsive {
  overflow-x: auto;
  margin: 1rem 0;
}

.listings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.listings-table thead {
  background: rgba(0, 0, 0, 0.3);
}

.listings-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  border-bottom: 2px solid rgba(253, 203, 110, 0.2);
  white-space: nowrap;
}

.listings-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.listing-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.listing-row:hover {
  background: var(--card-hover);
}

.listing-title {
  font-weight: 500;
  max-width: 250px;
}

.listing-price {
  font-weight: 600;
  color: var(--accent) !important;
  white-space: nowrap;
}

.listing-address {
  color: var(--text-secondary) !important;
  font-size: 0.85rem;
  max-width: 200px;
}

/* Source badges */
.source-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.source-immobilienscout, .source-immobilienscout24 {
  background: rgba(230, 126, 34, 0.2);
  color: #e67e22;
}

.source-immowelt {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.source-wg-gesucht, .source-wggesucht {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
}

.source-kleinanzeigen, .source-ebay-kleinanzeigen {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

.source-unknown {
  background: rgba(149, 165, 166, 0.2);
  color: #95a5a6;
}

.view-link {
  color: var(--accent) !important;
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
}

.view-link:hover {
  color: var(--accent-hover) !important;
  text-decoration: none;
}

/* No listings message */
.no-listings {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px dashed rgba(253, 203, 110, 0.3);
}

.no-listings p {
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

/* Responsive table */
@media (max-width: 992px) {
  .listings-table th,
  .listings-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }

  .listing-title {
    max-width: 150px;
  }

  .listing-address {
    max-width: 120px;
  }
}

@media (max-width: 768px) {
  .listings-table {
    font-size: 0.85rem;
  }

  /* Hide less important columns on mobile */
  .listings-table th:nth-child(5),
  .listings-table td:nth-child(5),
  .listings-table th:nth-child(7),
  .listings-table td:nth-child(7) {
    display: none;
  }
}

/* ===========================
   Filter Controls
   =========================== */

.filter-controls {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid rgba(253, 203, 110, 0.2);
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s;
}

.filter-checkbox:hover {
  color: var(--text-primary);
}

.filter-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ===========================
   Tag Buttons
   =========================== */

.listing-actions {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}

.tag-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tag-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

/* Favorite button */
.favorite-btn.active {
  background: rgba(255, 193, 7, 0.25);
  border-color: #ffc107;
  color: #ffc107;
}

.favorite-btn:hover {
  border-color: #ffc107;
  color: #ffc107;
}

/* Tauschwohnung button */
.tausch-btn.active {
  background: rgba(108, 117, 125, 0.3);
  border-color: #6c757d;
  color: #6c757d;
}

.tausch-btn:hover {
  border-color: #6c757d;
}

/* Archive button */
.archive-btn.active {
  background: rgba(0, 184, 148, 0.25);
  border-color: var(--success);
  color: var(--success);
}

.archive-btn:hover {
  border-color: var(--success);
  color: var(--success);
}

/* ===========================
   Row Styling for Tags
   =========================== */

/* Tauschwohnung - greyed out */
.row-tauschwohnung {
  opacity: 0.5;
}

.row-tauschwohnung td {
  color: var(--text-secondary) !important;
}

.row-tauschwohnung .listing-price {
  color: var(--text-secondary) !important;
}

/* Favorite - subtle highlight */
.row-favorite {
  background: rgba(255, 193, 7, 0.08);
}

.row-favorite:hover {
  background: rgba(255, 193, 7, 0.15);
}

/* Archived - hidden by default via JS, but visually marked if shown */
.row-archived {
  opacity: 0.4;
  background: rgba(0, 0, 0, 0.1);
}

/* Ensure buttons stay fully visible even on greyed rows */
.row-tauschwohnung .listing-actions,
.row-archived .listing-actions {
  opacity: 1;
}

.row-tauschwohnung .tag-btn,
.row-archived .tag-btn {
  opacity: 1;
}

/* ===========================
   Districts Grid
   =========================== */

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

.district-checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.district-checkbox:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(253, 203, 110, 0.3);
}

.district-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.district-checkbox input[type="checkbox"]:checked + .district-name {
  color: var(--accent);
  font-weight: 600;
}

.district-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: color 0.2s;
}

/* Selected district styling */
.district-checkbox:has(input:checked) {
  background: rgba(253, 203, 110, 0.1);
  border-color: rgba(253, 203, 110, 0.3);
}

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