/* ============================================================
   APP — Header, spreadsheet container, tracker table, stars, legend
   ============================================================ */

/* ----- App Section wrapper ----- */
#app-section {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ----- Header ----- */
header {
  background: #1e3a5f;
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.header-chorus {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-user {
  font-size: 13px;
  opacity: 0.85;
}

.btn-header {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-header:hover { background: rgba(255, 255, 255, 0.28); }

/* ----- Spreadsheet container ----- */
#spreadsheet-section {
  flex: 1;
  padding: 16px;
  overflow-x: auto;
}

#loading-msg {
  padding: 40px;
  text-align: center;
  color: #6b7280;
}

#table-wrapper {
  overflow-x: auto;
}

/* ----- Tracker Table ----- */
#tracker-table {
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

#tracker-table th,
#tracker-table td {
  border: 1px solid #e5e7eb;
  vertical-align: middle;
}

th {
  background: #1e3a5f;
  color: white;
  font-weight: 600;
  text-align: center;
}

/* Sticky singer-name column */
.name-col {
  text-align: left !important;
  min-width: 130px;
  white-space: nowrap;
  padding: 8px 12px;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
}

th.sticky-col {
  z-index: 3;
  background: #1e3a5f;
}

td.sticky-col {
  background: white;
}

/* Rotated song-name header columns */
.song-col {
  padding: 4px 2px !important;
  min-width: 50px;
  max-width: 50px;
}

.song-header-text {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: block;
  height: 130px;
  font-size: 11px;
  line-height: 1.3;
  padding: 6px 0;
  white-space: nowrap;
}

/* Song data cells */
.song-cell {
  text-align: center;
  padding: 4px 6px !important;
}

/* Current-user row highlight */
.my-row td            { background: #f0f9ff; }
.my-row td.sticky-col { background: #f0f9ff; }

.editable       { cursor: pointer; }
.editable:hover { background: #dbeafe !important; }

.singer-name { font-weight: 500; }

.you-badge {
  font-size: 10px;
  background: #3b82f6;
  color: white;
  padding: 1px 5px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 2px;
}

/* ----- Star Grid ----- */
/* Layout adapts to count: 1=centered, 2=side by side, 3=triangle, 4=square */
.star-grid {
  display: inline-flex;
  flex-direction: column;
  align-items: center;  /* centers shorter rows (triangle bottom, single star) */
  gap: 2px;
  line-height: 1;
}

.star-row {
  display: flex;
  gap: 2px;
  justify-content: center;
}

.star {
  font-size: 15px;
  line-height: 1;
  display: inline-block;
  width: 17px;
  text-align: center;
}

.star.bass     { color: #3b82f6; } /* blue   */
.star.baritone { color: #22c55e; } /* green  */
.star.lead     { color: #ef4444; } /* red    */
.star.tenor    { color: #eab308; } /* yellow */

/* ----- Legend ----- */
.legend {
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 10px 16px;
  flex-shrink: 0;
}

.legend-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #374151;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.legend-sep {
  width: 1px;
  height: 16px;
  background: #d1d5db;
}
