@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow+Condensed:wght@400;600&display=swap');

:root {
  --bg: #eaf4ff;
  --panel: #f7fbff;
  --text: #102a46;
  --muted: #5c748b;
  --accent: #0057d9;
  --accent-2: #3d8bff;
  --accent-orange: #f79007;
  --border: #bfd6f2;
  --line: rgba(61, 139, 255, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Barlow Condensed", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(61, 139, 255, 0.16) 0%, rgba(61, 139, 255, 0) 42%),
    radial-gradient(circle at 85% 12%, rgba(0, 87, 217, 0.16) 0%, rgba(0, 87, 217, 0) 36%),
    radial-gradient(circle at 50% 85%, rgba(89, 156, 255, 0.16) 0%, rgba(89, 156, 255, 0) 32%),
    repeating-linear-gradient(90deg, transparent 0 72px, var(--line) 72px 74px),
    var(--bg);
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  position: relative;
  padding: 20px 20px 14px;
  border: 1px solid rgba(0, 87, 217, 0.14);
  border-radius: 20px;
  background:
    radial-gradient(circle at 30% 15%, rgba(255, 189, 105, 0.24), transparent 32%),
    linear-gradient(135deg, rgba(0, 87, 217, 0.18), rgba(61, 139, 255, 0.10));
  box-shadow: 0 12px 30px rgba(0, 87, 217, 0.08);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 32%, rgba(255, 255, 255, 0.04) 33%),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.08) 18px 19px),
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(255, 255, 255, 0.08) 18px 19px);
  opacity: 0.55;
  pointer-events: none;
  transform: scale(1.1);
}

.hero h1 {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 1.2px;
  font-size: 2rem;
  line-height: 1;
}

.environment-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff3cd;
  border: 1px solid #e0a800;
  color: #6b4f00;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.environment-development {
  background: #ffe0e0;
  border-color: #d64545;
  color: #8a1f1f;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(61, 139, 255, 0.14);
  border-radius: 18px;
  padding: 22px;
  margin-top: 18px;
  box-shadow: 0 14px 32px rgba(0, 87, 217, 0.08);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 10px;
}

.install-app-btn {
  background: #0057d9;
  color: #ffffff;
  border-color: #0057d9;
}

.install-app-btn:hover {
  background: #003f9e;
  border-color: #003f9e;
}

.modal-close {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
}

.ios-install-steps {
  margin: 0;
  padding-left: 24px;
  display: grid;
  gap: 12px;
  line-height: 1.4;
}

.ios-share-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-left: 4px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 5px;
  font-family: Arial, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  vertical-align: -4px;
}

.panel h2,
.panel h3 {
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0.8px;
  margin: 0 0 8px;
}

#flashMessage {
  font-size: 1.1rem;
  padding: 10px 12px;
  border-radius: 10px;
}

.flash-success {
  background: rgba(79, 214, 133, 0.18);
  border: 1px solid rgba(79, 214, 133, 0.55);
  color: #000000;
}

.flash-error {
  background: rgba(255, 92, 92, 0.18);
  border: 1px solid rgba(255, 92, 92, 0.55);
  color: #000000;
}

form {
  display: grid;
  gap: 10px;
}

/* Modal error inline style */
.modal-error {
  background: #fff5f5;
  color: #8a1f1f;
  border-left: 4px solid #e53935;
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 14px;
  margin-bottom: 0;
  font-weight: 700;
  line-height: 1.4;
}

input, select, button {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(61, 139, 255, 0.18);
  font: inherit;
}

.input-with-clear {
  display: inline-flex;
  align-items: center;
}
.input-with-clear input {
  padding-right: 8px;
}
.clear-btn {
  margin-left: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
}

input,
select {
  background: #fffdf9;
  color: var(--text);
}

button {
  border: none;
  background: linear-gradient(135deg, rgba(0, 87, 217, 1), rgba(61, 139, 255, 0.92));
  color: #ffffff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 10px 18px rgba(0, 87, 217, 0.18);
  background-image:
    linear-gradient(135deg, rgba(0, 87, 217, 1), rgba(61, 139, 255, 0.92)),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), transparent 24%),
    radial-gradient(circle at 75% 70%, rgba(255, 255, 255, 0.12), transparent 24%);
}

button:hover {
  background: linear-gradient(135deg, rgba(14, 113, 245, 1), rgba(64, 161, 255, 0.98));
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 14px 26px rgba(0, 87, 217, 0.28);
}

#refreshBtn {
  background: rgba(61, 139, 255, 0.08);
  color: var(--accent);
  border: 1px solid rgba(61, 139, 255, 0.2);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  padding: 8px 12px;
}

#refreshBtn:hover {
  background: rgba(61, 139, 255, 0.18);
  color: var(--accent-2);
  transform: none;
}

.table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: visible;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 9px;
  text-align: left;
}

.table th {
  background: rgba(61, 139, 255, 0.12);
  color: var(--text);
}

.table tr.match-withdrawn td {
  text-decoration: line-through;
}

.table.admin-matches tr.match-withdrawn td:not(:last-child) input {
  text-decoration: line-through;
}

.table.admin-matches tr.match-withdrawn td:last-child {
  text-decoration: none;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.logout-form {
  display: inline-flex;
  margin: 0;
}

.language-switcher {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(61, 139, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.lang-flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.lang-flag-btn:hover {
  background: rgba(61, 139, 255, 0.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 87, 217, 0.10);
}

.lang-flag-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.lang-flag-btn.active {
  background: linear-gradient(135deg, rgba(0, 87, 217, 0.95), rgba(61, 139, 255, 0.92));
  color: #ffffff;
  border-color: rgba(255,255,255,0.24);
  box-shadow: 0 8px 18px rgba(0, 87, 217, 0.18);
}

.lang-flag-btn .flag {
  font-size: 1.05rem;
  line-height: 1;
}

.lang-flag-btn .lang-label {
  font-size: 0.95rem;
}

.btn-compact {
  width: auto;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.name-link {
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--accent-orange);
  text-decoration: underline;
  font: inherit;
}

.vacancy-link {
  padding: 4px 8px;
  background: rgba(247, 144, 7, 0.15);
  color: var(--accent-orange);
  border: 1px dashed rgba(247, 144, 7, 0.65);
  border-radius: 999px;
  text-transform: none;
}

.swap-offer-wrap {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.swap-offer-trigger {
  padding: 6px 12px;
  margin: 0;
  border: none;
  background: var(--accent-orange);
  color: #ffffff;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-transform: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(247, 144, 7, 0.35);
  transition: all 140ms ease;
}

.swap-offer-trigger:hover {
  background: #e07c00;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(247, 144, 7, 0.5);
}

/* own-vacancy-trigger styles removed (vacancy cancel disabled) */

.own-swap-trigger {
  padding: 6px 12px;
  margin: 0;
  border: none;
  background: var(--accent-orange);
  color: #ffffff;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-transform: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(247, 144, 7, 0.35);
  transition: all 140ms ease;
}

.own-swap-trigger:hover {
  background: #e07c00;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(247, 144, 7, 0.5);
}

.swap-offer-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  max-width: min(92vw, 340px);
  z-index: 9999;
  pointer-events: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fffefb;
  padding: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.swap-offer-popup p {
  margin: 0 0 8px;
  color: var(--muted);
}

.swap-offer-popup .swap-offer-link {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 1rem;
  text-transform: none;
}

.muted-action {
  color: var(--muted);
}

.choice-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 12px;
}

.choice-grid button {
  text-align: left;
  line-height: 1.4;
  text-transform: none;
}

.vacancy-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(247, 144, 7, 0.25);
  color: var(--accent-orange);
  border: 1px solid var(--accent-orange);
  margin-left: 6px;
  vertical-align: baseline;
}

.badge-offer {
  background: var(--accent-orange);
  color: #ffffff;
  border: 2px solid #d46c00;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(247, 144, 7, 0.4);
}

#output {
  white-space: pre-wrap;
  min-height: 80px;
  color: var(--text);
  background: rgba(61, 139, 255, 0.05);
  border: 1px solid rgba(61, 139, 255, 0.14);
  padding: 12px;
  border-radius: 14px;
}

.debug-mail-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fffefb;
}

.debug-mail-item h3 {
  margin-top: 0;
}

.debug-mail-body {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

@media (max-width: 760px) {
  .container {
    padding: 12px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .table {
    font-size: 0.95rem;
    min-width: 540px;
  }

  .table th,
  .table td {
    padding: 7px 8px;
  }

  .swap-offer-wrap {
    width: 100%;
    gap: 8px;
  }

  .swap-offer-trigger {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  /* removed .own-vacancy-trigger */

  .swap-offer-popup {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    max-width: none;
    min-width: 0;
    border-radius: 12px;
    z-index: 10000;
  }
}
