/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #5b4cff;
  --primary-dark: #4338e0;
  --available: #16a34a;
  --available-bg: #dcfce7;
  --taken: #dc2626;
  --taken-bg: #fee2e2;
  --manual: #6b7280;
  --manual-bg: #f3f4f6;
  --unknown: #92400e;
  --unknown-bg: #fef3c7;
  --bg: #f8f9ff;
  --card-bg: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.05);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #1a0f4f 0%, #2d1b8e 50%, #1a0f4f 100%);
  padding: 64px 24px 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 110%, rgba(91,76,255,.35) 0%, transparent 70%);
}

.hero-inner { position: relative; max-width: 680px; margin: 0 auto; }

/* ===== LANG SWITCHER ===== */
.lang-switcher {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 24px;
}

.lang-btn {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .05em;
}

.lang-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.lang-btn.active { background: rgba(255,255,255,.25); color: #fff; border-color: rgba(255,255,255,.4); }

.btn-home {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  letter-spacing: .02em;
  margin-right: auto;
}
.btn-home:hover { background: rgba(255,255,255,.2); color: #fff; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: -.3px;
}

.brand-logo svg { width: 32px; height: 32px; }

.hero h1 {
  color: #fff;
  font-size: clamp(1.75rem, 5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -.5px;
}

.hero p {
  color: rgba(255,255,255,.7);
  font-size: 1.05rem;
  margin-bottom: 36px;
}

/* ===== SEARCH FORM ===== */
.search-form {
  display: flex;
  gap: 0;
  max-width: 520px;
  margin: 0 auto 20px;
  background: #fff;
  border-radius: 50px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  overflow: hidden;
  padding: 6px 6px 6px 24px;
}

.search-form input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

.search-form input::placeholder { color: var(--text-muted); }

.search-form button {
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 44px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.search-form button:hover { background: var(--primary-dark); }

/* Examples */
.examples {
  color: rgba(255,255,255,.55);
  font-size: .88rem;
}

.example-tag {
  display: inline-block;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  border-radius: 20px;
  padding: 2px 12px;
  margin: 0 3px;
  cursor: pointer;
  transition: background .15s;
}

.example-tag:hover { background: rgba(255,255,255,.22); }

/* ===== MAIN CONTENT ===== */
.main { max-width: 1000px; margin: 0 auto; padding: 40px 20px 80px; }

/* ===== LOADING ===== */
.loading-state {
  text-align: center;
  padding: 64px 24px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-state p { color: var(--text-muted); font-size: .95rem; }

/* ===== RESULTS HEADER ===== */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.results-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.results-header h2 .brand-highlight {
  color: var(--primary);
}

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

/* ===== STATUS BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge.available  { background: var(--available-bg); color: var(--available); }
.badge.taken      { background: var(--taken-bg);     color: var(--taken); }
.badge.manual     { background: var(--manual-bg);    color: var(--manual); }
.badge.unknown    { background: var(--unknown-bg);   color: var(--unknown); }
.badge.checking   { background: #dbeafe;             color: #1d4ed8; }

.badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== SECTION ===== */
.section { margin-bottom: 36px; }

.section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ===== CARDS GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ===== CARD ===== */
.card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow);
}

.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }

.card.status-available { border-color: #bbf7d0; }
.card.status-taken     { border-color: #fecaca; }
.card.status-manual    { border-color: var(--border); }
.card.status-unknown   { border-color: #fde68a; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.card-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.card-action { margin-top: auto; }

.btn-register,
.btn-open {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}

.btn-register:hover,
.btn-open:hover { opacity: .85; }

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

.btn-open {
  background: var(--manual-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ===== SUGGESTIONS ===== */
.suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 6px 14px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  box-shadow: var(--shadow);
}

.suggestion-chip:hover {
  border-color: var(--primary);
  background: #f5f3ff;
  color: var(--primary);
}

/* ===== ERROR ===== */
.error-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--taken);
}

.error-state p { font-size: .95rem; margin-top: 8px; color: var(--text-muted); }

/* ===== EMPTY STATE ===== */
#results-area { display: none; }

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .main { padding: 28px 16px 60px; }
}

/* Mobile */
@media (max-width: 600px) {
  /* Hero */
  .hero { padding: 32px 16px 44px; }
  .hero h1 { font-size: 1.55rem; }
  .hero p { font-size: .92rem; margin-bottom: 24px; }

  /* Lang switcher + home button */
  .lang-switcher {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
  }
  .lang-switcher a[style] {
    font-size: .75rem;
    padding: 3px 10px;
  }

  /* Search form — stack vertically */
  .search-form {
    flex-direction: column;
    border-radius: 16px;
    padding: 12px;
    gap: 8px;
  }
  .search-form input {
    font-size: .95rem;
    padding: 4px 0;
    width: 100%;
  }
  .search-form button {
    width: 100%;
    border-radius: 10px;
    padding: 12px;
    font-size: .95rem;
  }

  /* Examples */
  .examples { font-size: .82rem; }
  .example-tag { margin: 2px; }
  .hide-mobile { display: none; }

  /* Badge above label on mobile */
  .card-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .card-top .badge { order: -1; }

  /* Main */
  .main { padding: 20px 12px 48px; }

  /* Results header */
  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
  }
  .results-header h2 { font-size: 1.15rem; }
  .legend { gap: 6px; }
  .badge { font-size: .72rem; padding: 2px 8px; }

  /* Cards */
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .card { padding: 12px; gap: 8px; }
  .card-label { font-size: .88rem; }

  /* Section */
  .section { margin-bottom: 24px; }
  .section-title { font-size: .75rem; margin-bottom: 10px; }

  /* Buttons inside cards */
  .btn-register,
  .btn-open { font-size: .78rem; padding: 6px 8px; }

  /* Suggestions */
  .suggestion-chip { font-size: .82rem; padding: 5px 12px; }
}

/* Very small screens */
@media (max-width: 360px) {
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .hero h1 { font-size: 1.35rem; }
}

/* ===== DARK MODE ===== */
[data-theme="light"] {
  --bg:         #f8f9ff;
  --card-bg:    #ffffff;
  --text:       #111827;
  --text-muted: #6b7280;
  --border:     #e5e7eb;
}
[data-theme="dark"] {
  --bg:          #0f172a;
  --card-bg:     #1e293b;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --border:      #334155;
  --available-bg: rgba(22,163,74,0.15);
  --taken-bg:     rgba(220,38,38,0.15);
  --manual-bg:    rgba(107,114,128,0.15);
  --unknown-bg:   rgba(180,83,9,0.15);
}
[data-theme="dark"] .search-form { background: #1e293b; }
[data-theme="dark"] .search-form input { color: #f1f5f9; }
[data-theme="dark"] .search-form input::placeholder { color: #64748b; }
[data-theme="dark"] .card.status-taken { border-color: rgba(220,38,38,0.3); }
[data-theme="dark"] .card.status-unknown { border-color: rgba(180,83,9,0.3); }
[data-theme="dark"] .section-title { color: #64748b; }
[data-theme="dark"] .badge.checking { background: rgba(37,99,235,0.2); color: #93c5fd; }
[data-theme="dark"] .suggestion-chip { background: #1e293b; border-color: #334155; color: #94a3b8; }
[data-theme="dark"] .results-header { border-color: #334155; }
[data-theme="dark"] .main { background: #0f172a; }
