/* ==========================================================================
   BIKER TALK - PHÒNG GẦN ĐÂY, TẠO MÃ PHÒNG & FOOTER BOTTOM (v1.9.0)
   ========================================================================== */

/* 1. Màn hình Chờ / Thiết lập phòng */
.screen-setup {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex: 1;
  gap: 16px;
  padding: 14px 0 10px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.setup-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.setup-card-header {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.setup-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-color);
  letter-spacing: 1px;
  margin: 0;
  text-transform: uppercase;
}

/* Hàng nhập mã phòng kèm nút sinh mã */
.room-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.room-input-row input {
  flex: 1;
}

.btn-gen-room {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1f2937;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

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

.btn-gen-room:active {
  transform: scale(0.97);
}

.btn-gen-room svg {
  color: var(--primary-color);
  width: 15px;
  height: 15px;
}

/* 2. Bảng danh sách các phòng đã tham gia gần đây */
.recent-rooms-card {
  background: var(--surface-color);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.recent-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-title svg {
  color: var(--primary-color);
  width: 16px;
  height: 16px;
}

.btn-clear-history {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-clear-history:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

.recent-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.recent-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.recent-table th.text-right,
.recent-table td.text-right {
  text-align: right;
}

.recent-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.recent-table tr:last-child td {
  border-bottom: none;
}

.recent-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.recent-room-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.recent-room-code:hover {
  text-decoration: underline;
}

.recent-time {
  color: var(--text-dim);
  font-size: 12px;
}

.recent-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-recent-join {
  background: rgba(255, 152, 0, 0.15);
  color: var(--primary-color);
  border: 1px solid rgba(255, 152, 0, 0.35);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-recent-join:hover {
  background: var(--primary-color);
  color: #000;
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.4);
}

.btn-recent-del {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 5px 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-recent-del:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

.recent-empty {
  text-align: center;
  padding: 24px 10px;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

/* 3. Bottom Footer: BmP | Biber Talk Ver 1.4.8 */
.setup-bottom-footer {
  margin-top: auto;
  padding: 16px 0 8px;
  text-align: center;
}

.bottom-footer-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  padding: 4px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.footer-brand {
  color: #cbd5e1;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.footer-sep {
  color: rgba(255, 255, 255, 0.25);
  user-select: none;
}

.footer-version {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
}

/* ==========================================================================
   4. CHẾ ĐỘ MÀN HÌNH XOAY NGANG (LANDSCAPE) - TRANG CHỦ CHIA 50-50 CHUẨN
   ========================================================================== */
@media screen and (orientation: landscape) {
  .screen-setup {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 4px 0 8px !important;
    align-items: stretch !important;
  }

  .screen-setup .setup-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    padding: 16px 18px !important;
  }

  .screen-setup .setup-card .btn-join-full {
    margin-top: auto !important;
  }

  .screen-setup .recent-rooms-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    padding: 16px 18px !important;
  }

  .recent-rooms-card .recent-table-wrap {
    flex: 1 !important;
    max-height: calc(100vh - 140px) !important;
    overflow-y: auto !important;
  }

  .setup-bottom-footer {
    display: none !important;
  }
}
