@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  --bg-color: #030420; /* Very dark blue */
  --row-alt-color: #0d1a45; /* Slightly lighter blue for odd rows */
  --text-primary: #ffffff;
  --text-yellow: #feca00;
  --header-bg: #000000;
  --header-border: #00a859; /* Green border */
  --icon-bg: #00e500;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: transparent;
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow: hidden;
  user-select: none; /* Prevents selection to feel more like an app */
}

.board-container {
  background-color: var(--bg-color);
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-app-region: drag; /* Allows dragging the frameless window */
  border-radius: 8px; /* Slight rounding for floating desktop widget feel */
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.header {
  display: flex;
  align-items: center;
  padding: 12px 12px;
  background-color: var(--header-bg);
}

.header-icon {
  width: 44px;
  height: 38px;
  background-color: var(--icon-bg);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 12px;
}

.header-icon svg {
  width: 28px;
  height: 28px;
  color: black;
}

.header-text {
  display: flex;
  align-items: center;
}

.header-text .title-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  transition: opacity 0.3s ease;
  opacity: 1;
}

.header-text .title-text.switching,
.header-col.switching,
.dest-main.switching {
  opacity: 0;
}

.settings-menu {
  margin-left: auto; /* Push to right */
  display: flex;
  align-items: center;
  gap: 10px;
  -webkit-app-region: no-drag; /* Allow clicking */
}

#airport-select {
  background-color: #1a1b3a;
  color: white;
  border: 1px solid #3a3b5a;
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
  transition: all 0.2s;
}

#airport-select:hover {
  background-color: #2a2b4a;
  border-color: var(--icon-bg);
}

.settings-gear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px;
}

.screen-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #00ffcc;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.settings-gear-btn:hover .screen-number-badge {
  background-color: #00a859;
  border-color: #00ffcc;
  color: #ffffff;
  transform: scale(1.1);
}

.table-header {
  display: grid;
  grid-template-columns: 85px minmax(140px, 1fr) 275px 95px 65px 105px;
  gap: 8px;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  background-color: var(--header-bg);
  font-size: 13px;
  font-weight: 700;
  color: #d0d0d0;
  white-space: nowrap;
}

.header-col {
  transition: opacity 0.3s ease;
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-border {
  height: 3px;
  background-color: var(--header-border);
}

.flight-list {
  flex: 1;
  overflow-y: auto; /* Enable vertical scroll */
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-app-region: no-drag; /* Allow scrolling and clicking inside the list */
}

/* Custom Scrollbar for premium feel */
.flight-list::-webkit-scrollbar {
  width: 8px;
}
.flight-list::-webkit-scrollbar-track {
  background: var(--bg-color);
}
.flight-list::-webkit-scrollbar-thumb {
  background: #3a3b5a;
  border-radius: 4px;
}
.flight-list::-webkit-scrollbar-thumb:hover {
  background: #4a4b6a;
}

.flight-row {
  display: grid;
  grid-template-columns: 85px minmax(140px, 1fr) 275px 95px 65px 105px;
  gap: 8px;
  align-items: center;
  height: 40px;
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

/* Dynamic Density Scaling Modes (自動サイズ変更) */
.board-container.density-large .flight-row { height: 50px; font-size: 20px; }
.board-container.density-large .dest-main { font-size: 22px; }
.board-container.density-large .flight-number { font-size: 19px; }
.board-container.density-large .table-header { height: 40px; font-size: 14px; }
.board-container.density-large .remarks-text { height: 30px; font-size: 14px; }
.board-container.density-large .airline-logo { width: 44px; height: 25px; }

.board-container.density-medium .flight-row { height: 40px; font-size: 18px; }
.board-container.density-medium .dest-main { font-size: 19px; }
.board-container.density-medium .flight-number { font-size: 17px; }
.board-container.density-medium .table-header { height: 36px; font-size: 13px; }
.board-container.density-medium .remarks-text { height: 26px; font-size: 13px; }
.board-container.density-medium .airline-logo { width: 38px; height: 22px; }

.board-container.density-compact .flight-row { height: 34px; font-size: 16px; }
.board-container.density-compact .dest-main { font-size: 17px; }
.board-container.density-compact .flight-number { font-size: 15px; }
.board-container.density-compact .table-header { height: 32px; font-size: 12px; }
.board-container.density-compact .remarks-text { height: 22px; font-size: 12px; padding: 0 8px; }
.board-container.density-compact .airline-logo { width: 32px; height: 18px; }

.board-container.density-dense .flight-row { height: 28px; font-size: 14px; }
.board-container.density-dense .dest-main { font-size: 15px; }
.board-container.density-dense .flight-number { font-size: 13px; }
.board-container.density-dense .table-header { height: 28px; font-size: 11px; }
.board-container.density-dense .remarks-text { height: 20px; font-size: 11px; padding: 0 6px; }
.board-container.density-dense .airline-logo { width: 28px; height: 15px; }

.flight-row:nth-child(even) {
  background-color: var(--row-alt-color);
}

/* Columns */
.col-schedule { text-align: left; }
.col-estimated { text-align: left; }
.col-destination {
  display: flex;
  align-items: center;
  overflow: hidden;
}
.col-flight { display: flex; align-items: center; gap: 8px; }
.col-terminal { text-align: center; }
.col-gate { text-align: center; }
.col-remarks {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  overflow: hidden;
  height: 100%;
}

.remarks-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff; /* White text (文字白) */
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 25px; /* Shrunken vertical height to form a horizontal rectangle (長方形) */
  padding: 0 10px; /* Horizontal rectangle badge */
  border-radius: 0px; /* Rectangular shape */
  transition: opacity 0.3s ease;
  opacity: 1;
}

.remarks-text.switching {
  opacity: 0;
}

/* Simple, pure primary flat solid background colors */
.remarks-text.status-gate-open { background-color: #00b300; }
.remarks-text.status-boarding { background-color: #00c800; }
.remarks-text.status-last-call { background-color: #ff6600; }
.remarks-text.status-gate-closing { background-color: #ff0000; }
.remarks-text.status-re-timed { background-color: #ff8000; }
.remarks-text.status-canceled { background-color: #ff0000; }

.schedule-time {
  position: relative;
  padding-left: 16px; /* Fixed left padding so all time numbers align vertically */
}

/* Yellow dot for changed flights sits inside the left padding space */
.has-changed .schedule-time::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  background-color: var(--text-yellow);
  border-radius: 50%;
}

.estimated-time {
  color: var(--text-yellow);
}

.dest-main {
  font-size: 22px;
  font-weight: 700;
}

.dest-sub {
  display: none;
}

.flight-info-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flight-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-flight {
  width: 135px;
  flex-shrink: 0;
}

.codeshare-flight {
  width: 135px;
  flex-shrink: 0;
}

.airline-logo {
  width: 42px;
  height: 24px;
  object-fit: contain;
  background-color: white;
  border-radius: 3px;
  padding: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.flight-number {
  font-family: monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Settings Modal Panel Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  -webkit-app-region: no-drag;
}

.modal-content {
  background-color: #0d1a45;
  border: 2px solid #00a859;
  border-radius: 8px;
  width: 360px;
  max-width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
  overflow: hidden;
}

.modal-header {
  background-color: #000000;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #00a859;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover {
  color: white;
}

.modal-body {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item label {
  font-size: 14px;
  font-weight: 700;
  color: #ccc;
}

.setting-item select {
  background-color: #1a1b3a;
  color: white;
  border: 1px solid #3a3b5a;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}

.setting-item select:focus {
  border-color: #00a859;
}

.checkbox-item {
  flex-direction: row;
  align-items: center;
}

.checkbox-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: white;
  font-size: 14px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.action-btn {
  background-color: #2a2b4a;
  color: #ffffff;
  border: 1px solid #4a4b6a;
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.action-btn:hover {
  background-color: #3a3b5a;
  border-color: #00a859;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
}

.save-btn {
  background-color: #00a859;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.save-btn:hover {
  background-color: #008f4c;
}

/* Vertical / Portrait Screen Support (縦画面・狭幅モニター対応) */
@media (max-width: 680px), (orientation: portrait) {
  .table-header,
  .flight-row {
    grid-template-columns: 60px minmax(90px, 1fr) 175px 45px 45px 85px;
    gap: 4px;
    padding: 0 6px;
  }

  .col-schedule { font-size: 15px; padding-left: 8px; }
  .dest-main { font-size: 16px; }
  .flight-number { font-size: 13px; }
  .main-flight, .codeshare-flight { width: 80px; }
  .col-flight { gap: 3px; }
  .col-terminal, .col-gate { font-size: 14px; }
  .remarks-text { font-size: 11px; padding: 0 4px; height: 22px; }
  .airline-logo { width: 26px; height: 15px; }

  /* Header adjustments in portrait */
  .main-header { padding: 8px 12px; }
  .header-left .airport-title { font-size: 18px; }
}

/* Startup Loading Screen Overlay */
.app-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #161730 0%, #080918 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.app-loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.radar-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 204, 0.25);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.radar-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(0, 255, 204, 0.6) 0deg, transparent 90deg);
  animation: radar-sweep 2s linear infinite;
}

@keyframes radar-sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.airplane-icon {
  font-size: 28px;
  color: #00ffcc;
  z-index: 2;
  transform: rotate(-45deg);
  text-shadow: 0 0 12px #00ffcc;
}

.loading-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.loading-status {
  font-size: 13px;
  font-weight: 700;
  color: #00ffcc;
  letter-spacing: 1px;
  animation: pulse-glow 1.5s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  from { opacity: 0.6; }
  to { opacity: 1.0; }
}
