/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f5f5f5;
  overflow: hidden;
}

/* Header Section */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  min-height: 72px;
}

.header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3498db, #2ecc71, #f39c12, #e74c3c);
}

.logo {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0;
}

/* Tab Navigation */
.topnav {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #ddd;
  background: #f7f7f7;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
  padding: 8px 16px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.tab-btn:hover {
  background: #f0f0f0;
}

.tab-btn.active {
  background: #222;
  color: #fff;
  border-color: #222;
}

/* Simplified team name input section styles - removed labels and display headers */
.team-name-section {
  display: flex;
  justify-content: start;
  align-items: center;
  padding: 8px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.team-name-input {
  padding: 6px 12px;
  border: 1px solid #ced4da;
  border-radius: 1px;
  font-size: 14px;
  background: white;
  transition: all 0.2s ease;
  width: 180px;
  text-align: center;
  display: none; /* Hide by default */
}

.team-name-input.active {
  display: block; /* Show only active input */
}

.team-name-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.team-name-input:hover {
  border-color: #adb5bd;
}

.team-name-input::placeholder {
  color: #6c757d;
  font-style: italic;
}

.team-name-input-group {
  display: flex;
  align-items: center;
}

.team-name-input {
  padding: 10px 15px;
  border: 2px solid #ced4da;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  background: white;
  transition: all 0.3s ease;
  min-width: 220px;
  text-align: center;
}

.team-name-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  background: #f8f9fa;
}

.team-name-input:hover {
  border-color: #adb5bd;
}

.team-name-input::placeholder {
  color: #6c757d;
  font-style: italic;
}

/* Added team display header styles */
.team-display-section {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, #343a40 0%, #495057 100%);
  border-bottom: 3px solid #007bff;
}

.team-display-header {
  font-size: 20px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  min-width: 200px;
  text-align: center;
  transition: all 0.3s ease;
}

.team-display-header:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  background: white;
  flex-wrap: wrap;
}

.toolbar button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
}

.toolbar button:hover {
  background: #f0f0f0;
}

.zoom-btn {
  font-size: 16px !important;
  font-weight: bold;
  padding: 6px 10px !important;
}

.reset-btn {
  background: #ff4444 !important;
  color: white !important;
  border-color: #ff4444 !important;
}

.reset-btn:hover {
  background: #ff3333 !important;
}

.delete-inning-btn {
  background: #f44336 !important;
  color: white !important;
  border-color: #f44336 !important;
}

.delete-inning-btn:hover {
  background: #da190b !important;
}

.inning-number-control {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 5px;
}

.inning-number-control label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.inning-number-control input {
  width: 80px;
  padding: 5px 8px;
  margin-right: 10px;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.reset-inning {
  background: #ff9800 !important;
}

.reset-inning:hover {
  background: #f57c00 !important;
}

.add-inning-btn {
  background: #9c27b0 !important;
  color: white !important;
  border-color: #9c27b0 !important;
}

.add-inning-btn:hover {
  background: #8e24aa !important;
}

.export-btn {
  background: #4caf50 !important;
  color: white !important;
  border-color: #4caf50 !important;
}

.export-btn:hover {
  background: #45a049 !important;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  cursor: pointer;
}

.tip {
  color: #666;
  font-size: 12px;
}

.pct {
  margin-left: auto;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

/* Simple Inning Controls in Toolbar */
.simple-inning-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 0 8px;
}

.simple-inning-controls label {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  margin: 0;
}

.simple-inning-controls input[type='number'] {
  width: 50px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  text-align: center;
}

.simple-inning-controls input[type='number']:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.simple-inning-controls .apply-btn {
  background: #2196f3;
  color: white;
  border: 1px solid #2196f3;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
}

.simple-inning-controls .apply-btn:hover {
  background: #1976d2;
  border-color: #1976d2;
}

/* Viewport - Updated height calculation to account for new sections */
.viewport {
  overflow: auto;
  height: calc(100vh - 280px); /* Adjusted for team name sections */
  background: #fff;
  position: relative;
}

.sheetWrap {
  transform-origin: 0 0;
  padding: 20px;
  display: inline-block;
  min-width: 100%;
}

/* Scorebook Grid */
.scorebook-table {
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #333;
  min-width: 100%;
  table-layout: fixed;
}

.scorebook-table th,
.scorebook-table td {
  border: 1px solid #333;
  text-align: center;
  vertical-align: middle;
  position: relative;
  padding: 8px;
}

/* Headers */
.scorebook-table th {
  background: #e8e8e8;
  font-weight: bold;
  font-size: 12px;
  padding: 12px 8px;
  min-height: 45px;
  white-space: nowrap;
  border: 1px solid #333;
}

.header-innings {
  width: 140px;
  min-width: 140px;
  font-size: 13px;
  font-weight: bold;
  position: relative;
  transition: all 0.3s ease;
  padding: 4px 20px 4px 4px; /* Updated padding */
  min-width: 50px; /* Updated min-width */
}

/* Enhanced Current Inning Highlighting */
.header-innings.current-inning {
  background: #2196f3 !important;
  color: white !important;
  box-shadow: 0 0 15px rgba(33, 150, 243, 0.6);
  animation: pulseInning 2s infinite;
  z-index: 10;
}

@keyframes pulseInning {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.6);
  }
  50% {
    box-shadow: 0 0 25px rgba(33, 150, 243, 0.9);
  }
}

/* Current inning column cells highlighting */
.diamond-cell.current-inning {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
  border: 2px solid #2196f3 !important;
  box-shadow: inset 0 0 8px rgba(33, 150, 243, 0.3);
  animation: currentInningGlow 3s infinite;
  cursor: move; /* Added cursor move for draggable functionality */
}

@keyframes currentInningGlow {
  0%,
  100% {
    box-shadow: inset 0 0 8px rgba(33, 150, 243, 0.3);
  }
  50% {
    box-shadow: inset 0 0 15px rgba(33, 150, 243, 0.5);
  }
}

/* Enhanced cell hover effect for right-click indication */
.diamond-cell:hover {
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.02);
}

/* Added styles for draggable gold box functionality */
.diamond-cell.draggable-highlight {
  cursor: move;
  box-shadow: 0 0 15px rgba(255, 193, 7, 0.8);
}

.diamond-cell.drag-target {
  border: 2px dashed #4caf50 !important;
  animation: dragTargetPulse 1s infinite;
}

@keyframes dragTargetPulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.8);
  }
}

/* Current batter highlighting - more prominent */
.diamond-cell.current-batter {
  background: linear-gradient(
    135deg,
    #fff3e0 0%,
    #ffcc02 30%,
    #fff3e0 100%
  ) !important;
  border: 3px solid #ff9800 !important;
  box-shadow: inset 0 0 10px rgba(255, 152, 0, 0.4),
    0 0 20px rgba(255, 152, 0, 0.6);
  animation: currentBatterPulse 1.5s infinite;
  transform: scale(1.02);
  z-index: 5;
  cursor: move; /* Added cursor move for draggable functionality */
}

@keyframes currentBatterPulse {
  0%,
  100% {
    box-shadow: inset 0 0 10px rgba(255, 152, 0, 0.4),
      0 0 20px rgba(255, 152, 0, 0.6);
  }
  50% {
    box-shadow: inset 0 0 15px rgba(255, 152, 0, 0.6),
      0 0 30px rgba(255, 152, 0, 0.8);
  }
}

.inning-control-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  transition: all 0.2s ease;
}

.inning-control-btn:hover {
  background: #1976d2;
  transform: scale(1.1);
}

.header-stats {
  width: 55px;
  min-width: 55px;
  font-size: 11px;
  font-weight: bold;
}

/* Player Info Columns */
.header-lineup {
  position: sticky;
  left: 45px;
  z-index: 24;
  background: #e8e8e8;
  width: 200px;
  min-width: 200px;
}

.lineup-cell {
  background: #f8f8f8;
  text-align: left;
  padding: 8px;
  width: 200px;
  min-width: 200px;
  border-right: 2px solid #666;
  vertical-align: top;
  position: sticky !important;
  left: 45px; /* Keep lineup sticky positioned after player numbers */
  z-index: 19;
}

.lineup-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 13px;
  outline: none;
  padding: 3px;
  font-weight: 500;
  margin-bottom: 4px;
}

.substitution-box {
  width: 100%;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 11px;
  outline: none;
  padding: 2px;
  border-radius: 2px;
  color: #666;
}

.substitution-box::placeholder {
  color: #999;
  font-style: italic;
}

.pos-cell {
  background: #f0f0f0;
  font-size: 11px;
  width: 60px;
  min-width: 60px;
  padding: 12px 8px;
  border-right: 2px solid #666;
  /* Removed sticky positioning from position column */
}

.pos-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 11px;
  outline: none;
  text-align: center;
  font-weight: bold;
}

/* Player Number Column */
.player-num {
  background: #e0e0e0;
  font-weight: bold;
  font-size: 14px;
  width: 45px;
  min-width: 45px;
  color: #333;
  padding: 12px 8px;
  border-right: 2px solid #666;
  position: sticky !important;
  left: 0;
  z-index: 20;
}

/* Enhanced current batter row highlighting */
.player-num.current-batter {
  background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%) !important;
  color: white !important;
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

/* Diamond Cells - RESPONSIVE SIZING */
.diamond-cell {
  position: relative;
  background: white;
  width: 140px;
  height: 140px;
  min-width: 140px;
  min-height: 140px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.3s ease;
}

.diamond-cell.inning-ended {
  position: relative;
}

/* Updated inning slash styling */
.diamond-cell.inning-ended::after {
  content: '\\';
  position: absolute;
  top: 78px;
  right: 0px;
  font-size: 24px;
  font-weight: bold;
  color: #ff4444;
  z-index: 20;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.diamond-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.diamond-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  transform: translate(-50%, -50%);
  overflow: visible;
}

/* Diamond Shapes */
.diamond-shape {
  fill: transparent;
  stroke: #666;
  stroke-width: 1.5;
  stroke-dasharray: 4, 3;
}

.diamond-fill {
  fill: #4caf50;
  fill-opacity: 0.4;
  stroke: #333;
  stroke-width: 2;
  visibility: hidden;
}

.base-line {
  stroke: #000;
  stroke-width: 3;
  visibility: hidden;
  stroke-linecap: round;
}

/* SVG End Slash */

/* Code Buttons - LEFT SIDE - IMPROVED */
.code-strip {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 22px;
  width: 20px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 10;
}

.code-btn {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #aaa;
  border-radius: 3px;
  cursor: pointer;
  padding: 1px;
  text-align: center;
  flex: 1;
  font-size: 7px;
  font-weight: bold;
  transition: all 0.12s;
  min-height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  color: #333;
  white-space: nowrap;
  overflow: hidden;
}

.code-btn:hover {
  background: rgba(230, 230, 230, 0.98);
  transform: scale(1.02);
  border-color: #777;
}

.code-btn.active {
  background: #ff4444;
  color: white;
  border-color: #ff4444;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transform: scale(1.01);
}

/* Bottom Code Strip - IMPROVED */
.bottom-strip {
  position: absolute;
  bottom: 2px;
  left: 25px;
  right: 24px;
  height: 16px;
  display: flex;
  gap: 1px;
  z-index: 10;
}

.bottom-code-btn {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #aaa;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  flex: 1;
  font-size: 7px;
  font-weight: bold;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  color: #333;
  padding: 5px;
}

.bottom-code-btn:hover {
  background: rgba(230, 230, 230, 0.98);
  transform: scale(1.05);
  border-color: #777;
  padding: 5px;
}

.bottom-code-btn.active {
  background: #2196f3;
  color: white;
  border-color: #2196f3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transform: scale(1.01);
  padding: 5px;
}

/* RBI Counter */
.rbi-btn {
  background: rgba(255, 193, 7, 0.98) !important;
  border-color: #ffc107 !important;
  color: #333 !important;
}

.rbi-btn:hover {
  background: rgba(255, 183, 7, 0.98) !important;
  border-color: #ffb300 !important;
}

.rbi-btn.active {
  background: #ff9800 !important;
  color: white !important;
  border-color: #ff9800 !important;
}

/* Out Boxes - RIGHT SIDE - IMPROVED */
.out-strip {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 10;
}

.out-box {
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #aaa;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: bold;
  transition: all 0.12s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  color: #333;
}

.out-box:hover {
  background: rgba(230, 230, 230, 0.98);
  transform: scale(1.05);
  border-color: #777;
}

.out-box.active {
  background: #f44336;
  color: white;
  border-color: #f44336;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transform: scale(1.02);
}

.out-box.disabled {
  background: rgba(200, 200, 200, 0.5) !important;
  color: #999 !important;
  cursor: not-allowed !important;
  border-color: #ccc !important;
  opacity: 0.6;
}

.out-box.disabled:hover {
  background: rgba(200, 200, 200, 0.5) !important;
  transform: none !important;
  border-color: #ccc !important;
}

/* Stats Cells */
.stat-cell {
  background: #f8f8f8;
  width: 55px;
  min-width: 55px;
  font-size: 12px;
  font-weight: bold;
  padding: 12px 8px;
  color: #333;
  border-left: 2px solid #666;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 0;
  border: none;
  border-radius: 8px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #999;
}

.close:hover {
  color: #333;
}

.modal-body {
  padding: 20px;
}

.code-section,
.position-section {
  margin-bottom: 20px;
}

.code-section h4,
.position-section h4 {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.code-buttons,
.position-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.modal-code-btn,
.modal-pos-btn {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  text-align: left;
}

.modal-code-btn:hover,
.modal-pos-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.modal-code-btn.selected,
.modal-pos-btn.selected {
  background: #2196f3;
  color: white;
  border-color: #2196f3;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.apply-btn,
.clear-btn,
.inning-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.apply-btn {
  background: #4caf50;
  color: white;
}

.apply-btn:hover {
  background: #45a049;
}

.clear-btn {
  background: #f44336;
  color: white;
}

.clear-btn:hover {
  background: #da190b;
}

.inning-btn {
  background: #2196f3;
  color: white;
  margin: 5px;
  padding: 12px 20px;
}

.inning-btn:hover {
  background: #1976d2;
}

.inning-btn.end-inning {
  background: #ff5722;
}

.inning-btn.end-inning:hover {
  background: #e64a19;
}

.inning-btn.undo-inning {
  background: #ff9800;
}

.inning-btn.undo-inning:hover {
  background: #f57c00;
}

.inning-btn.secondary {
  background: #9e9e9e;
}

.inning-btn.secondary:hover {
  background: #757575;
}

.inning-actions {
  text-align: center;
}

/* New Modal Styles */
.inning-selector {
  margin-bottom: 20px;
}

.inning-selector label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
  color: #333;
}

.inning-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background: white;
}

.delete-confirm-btn {
  background: #f44336 !important;
  color: white !important;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.delete-confirm-btn:hover {
  background: #da190b !important;
}

.cancel-btn {
  background: #9e9e9e !important;
  color: white !important;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.cancel-btn:hover {
  background: #757575 !important;
}

.next-inning-options {
  text-align: center;
  margin-top: 20px;
}

/* Manual Position Control Styles */
.manual-position-control {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 15px;
  margin: 20px 0;
  border: 1px solid #dee2e6;
}

.manual-position-control h4 {
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.position-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: #555;
  min-width: 90px;
  text-align: right;
}

.input-group input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  max-width: 80px;
}

.input-group input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

#goToPositionBtn {
  margin-top: 8px;
  background: #28a745 !important;
  color: white !important;
  border: none !important;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#goToPositionBtn:hover {
  background: #218838 !important;
  transform: translateY(-1px);
}

/* Debug Mode */
.debug .diamond-cell {
  border: 2px dashed red;
}

.debug .diamond-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255, 0, 0, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

/* Table Rows */
.scorebook-table tr {
  min-height: 140px;
}

.scorebook-table tbody tr:nth-child(even) {
  background-color: rgba(248, 248, 248, 0.5);
}

.scorebook-table tbody tr:hover {
  background-color: rgba(220, 220, 220, 0.3);
}

/* Context Menu Styles */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  min-width: 160px;
  display: none;
  padding: 4px 0;
}

.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.context-menu-item:hover {
  background-color: #f5f5f5;
}

.context-menu-item:active {
  background-color: #e0e0e0;
}

.context-menu-icon {
  font-size: 14px;
  width: 16px;
  text-align: center;
}

/* Added styling for undo context menu item */
.context-menu-item#undoEndInningContext {
  border-top: 1px solid #eee;
  margin-top: 4px;
  padding-top: 12px;
}

.context-menu-item#undoEndInningContext:hover {
  background-color: #fff3e0;
}

/* Responsive adjustments for team name section */
@media (max-width: 768px) {
  .team-name-section {
    flex-direction: column;
    gap: 20px;
    padding: 6px 15px;
  }

  .team-name-input {
    width: 160px;
    font-size: 13px;
    padding: 5px 10px;
  }

  .team-display-section {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
  }

  .team-display-header {
    font-size: 16px;
    min-width: 160px;
    padding: 6px 15px;
  }

  .viewport {
    height: calc(100vh - 320px); /* Adjusted for mobile */
  }
}

@media (max-width: 480px) {
  .team-name-section {
    padding: 5px 12px;
    gap: 15px;
  }

  .team-name-input {
    width: 140px;
    font-size: 12px;
    padding: 4px 8px;
  }

  .team-display-header {
    font-size: 14px;
    min-width: 140px;
    padding: 5px 12px;
  }

  .viewport {
    height: calc(100vh - 340px); /* Further adjusted for small screens */
  }
}

@media (max-width: 1600px) {
  .diamond-cell {
    width: 120px;
    height: 120px;
    min-width: 120px;
    min-height: 120px;
    padding: 3px;
  }

  .header-innings {
    width: 120px;
    min-width: 120px;
  }

  .scorebook-table tr {
    min-height: 120px;
  }

  .diamond-svg {
    width: 60px;
    height: 60px;
  }

  .code-strip {
    width: 18px;
    bottom: 20px;
  }

  .code-btn {
    font-size: 6px;
    min-height: 14px;
  }

  .bottom-strip {
    height: 15px;
    left: 30px;
    right: 21px;
  }

  .bottom-code-btn {
    font-size: 6px;
    padding: 5px;
  }

  .out-strip {
    width: 18px;
  }

  .out-box {
    width: 16px;
    height: 16px;
    font-size: 6px;
  }
}

@media (max-width: 1400px) {
  .diamond-cell {
    width: 110px;
    height: 110px;
    min-width: 110px;
    min-height: 110px;
    padding: 3px;
  }

  .header-innings {
    width: 110px;
    min-width: 110px;
  }

  .scorebook-table tr {
    min-height: 110px;
  }

  .diamond-svg {
    width: 55px;
    height: 55px;
  }

  .code-strip {
    width: 17px;
    bottom: 18px;
  }

  .code-btn {
    font-size: 6px;
    min-height: 13px;
  }

  .bottom-strip {
    height: 14px;
    left: 25px;
    right: 20px;
  }

  .bottom-code-btn {
    font-size: 6px;
    border-radius: 2px;
    padding: 5px;
  }

  .out-strip {
    width: 17px;
  }

  .out-box {
    width: 15px;
    height: 15px;
    font-size: 6px;
  }
}

@media (max-width: 1200px) {
  .scorebook-table {
    font-size: 11px;
  }

  .diamond-cell {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    padding: 2px;
  }

  .header-innings {
    width: 100px;
    min-width: 100px;
  }

  .lineup-cell {
    width: 180px;
    min-width: 180px;
  }

  .toolbar {
    font-size: 12px;
  }

  .scorebook-table tr {
    min-height: 100px;
  }

  .diamond-svg {
    width: 50px;
    height: 50px;
  }

  .code-strip {
    width: 16px;
    bottom: 16px;
  }

  .code-btn {
    font-size: 5px;
    min-height: 12px;
    border-radius: 2px;
  }

  .bottom-strip {
    height: 13px;
    left: 25px;
    right: 18px;
  }

  .bottom-code-btn {
    font-size: 5px;
    border-radius: 2px;
    padding: 5px;
  }

  .out-strip {
    width: 16px;
  }

  .out-box {
    width: 14px;
    height: 14px;
    font-size: 5px;
    border-radius: 2px;
  }
}

@media (max-width: 900px) {
  .diamond-cell {
    width: 90px;
    height: 90px;
    min-width: 90px;
    min-height: 90px;
    padding: 2px;
  }

  .header-innings {
    width: 90px;
    min-width: 90px;
  }

  .lineup-cell {
    width: 160px;
    min-width: 160px;
  }

  .scorebook-table tr {
    min-height: 90px;
  }

  .diamond-svg {
    width: 45px;
    height: 45px;
  }

  .code-strip {
    width: 15px;
    bottom: 15px;
  }

  .code-btn {
    font-size: 5px;
    min-height: 10px;
    border-radius: 2px;
  }

  .bottom-strip {
    height: 12px;
    left: 22px;
    right: 17px;
  }

  .bottom-code-btn {
    font-size: 5px;
    border-radius: 2px;
    padding: 4px;
  }

  .out-strip {
    width: 15px;
  }

  .out-box {
    width: 13px;
    height: 13px;
    font-size: 5px;
    border-radius: 2px;
  }
}

/* Added styles for editable inning number inputs */
.inning-number-input {
  width: 35px !important;
  height: 20px !important;
  border: 1px solid #ddd !important;
  border-radius: 3px !important;
  text-align: center !important;
  font-size: 12px !important;
  font-weight: bold !important;
  background: white !important;
  margin: 0 !important;
  padding: 2px !important;
  transition: all 0.2s ease !important;
}

.inning-number-input:focus {
  outline: none !important;
  border-color: #2196f3 !important;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15) !important;
  background: #f8f9fa !important;
}

.inning-number-input:hover {
  border-color: #999 !important;
  background: #f8f9fa !important;
}

.scorebook-table th:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 25;
  background: #e8e8e8;
  width: 45px;
  min-width: 45px;
}

.scorebook-table th:nth-child(2) {
  position: sticky;
  left: 45px;
  z-index: 24;
  background: #e8e8e8;
  width: 200px;
  min-width: 200px;
}

.scorebook-table th:nth-child(3) {
  /* Removed sticky positioning from position header */
  background: #e8e8e8;
}

/* Added styles for inning score boxes */
.inning-score-box {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: #4caf50;
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 4px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 30;
  border: 2px solid #2e7d32;
  transition: all 0.3s ease;
}

.inning-score-box:hover {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Enhanced styling for score boxes with different score ranges */
.inning-score-box.score-zero {
  background: #9e9e9e;
  border-color: #757575;
  color: #fff;
}

.inning-score-box.score-low {
  background: #4caf50;
  border-color: #2e7d32;
}

.inning-score-box.score-medium {
  background: #ff9800;
  border-color: #f57c00;
}

.inning-score-box.score-high {
  background: #f44336;
  border-color: #d32f2f;
}

/* Adjust header innings padding to accommodate score box */
.header-innings {
  padding-top: 35px !important; /* Make room for score box */
}
