/* Red Storm Tools - Shared Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: #2d3d2d;
  color: #f4f4f4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: scroll; /* Always show scrollbar to prevent layout shift */
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px;
  background-color: #1a2a1a;
  border-radius: 8px;
  border-bottom: 2px solid #4a5a4a;
  max-width: 1050px;
  margin: 0 auto 40px auto;
}

.title {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 18px;
  font-style: italic;
  opacity: 0.8;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section {
  background-color: #3a4a3a;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #4a5a4a;
  max-width: 100%;
  margin: 0 auto;
}

.section-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #f4f4f4;
  text-align: center;
}

/* Buttons */
.button {
  padding: 15px 25px;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: transform 0.1s;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.action-button {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.action-button:hover {
  opacity: 0.9;
}

.control-button {
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.control-button:hover {
  opacity: 0.8;
}

/* Button Colors */
.small-button {
  background-color: #d32f2f;
}

.small-button:hover {
  background-color: #b71c1c;
}

.large-button {
  background-color: #1976d2;
}

.large-button:hover {
  background-color: #1565c0;
}

.roll-button {
  background-color: #5d6d47;
}

.cancel-button {
  background-color: #6a6a6a;
}

.history-button {
  background-color: #5d6d47;
  flex: 1;
  max-width: 200px;
}

.reset-button {
  background-color: #4a4a4a;
  flex: 1;
  max-width: 200px;
}

.links-button {
  background-color: #6d5d47;
  min-width: 120px;
}

.clear-results {
  background-color: #d32f2f;
  padding: 8px 16px;
  font-size: 14px;
}

/* NATO/Warsaw Pact Faction Colors */
.nato-header {
  background-color: #1976d2;
  color: white;
}

.nato-table {
  background-color: #1976d2;
}

.nato-table:hover {
  background-color: #1565c0;
}

.warsaw-header {
  background-color: #d32f2f;
  color: white;
}

.warsaw-table {
  background-color: #d32f2f;
}

.warsaw-table:hover {
  background-color: #b71c1c;
}

/* Text Colors */
.small-text {
  color: #d32f2f;
}

.large-text {
  color: #1976d2;
}

.placeholder-text {
  color: #9e9e9e;
}

/* Layout Components */
.faction-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.faction-header {
  font-size: 18px;
  font-weight: bold;
  padding: 10px 15px;
  border-radius: 6px;
  text-align: center;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 15px;
  max-width: 100%;
  width: 100%;
}

.table-button {
  padding: 12px 8px;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  min-height: 48px;
}

.table-button:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

.table-button:active {
  transform: translateY(0);
}

/* Table View Overlay */
.table-view-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.table-view-modal {
  background-color: #3a4a3a;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #4a5a4a;
  max-width: 750px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

/* Scenario Date Toggle */
.scenario-date-button {
  background-color: #4a5a4a !important;
  color: #f4f4f4 !important;
  border: 2px solid #6a7a6a !important;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.scenario-date-button:hover {
  background-color: #5a6a5a !important;
  border-color: #7a8a7a !important;
}

.scenario-date-button.active {
  background-color: #2a5a3a !important;
  border-color: #4a8a5a !important;
  color: #e4f4e4 !important;
}

/* Forms and Inputs */
.roll-input-section {
  display: none;
  margin-top: 20px;
  padding: 20px;
  background-color: #4a5a4a;
  border-radius: 8px;
  text-align: center;
}

.roll-input-section.active {
  display: block;
}

.selected-table {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
}

.input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.input-group label {
  font-weight: bold;
  white-space: nowrap;
}

.input-group input, .input-group select {
  padding: 8px 12px;
  border: 1px solid #6a7a6a;
  border-radius: 4px;
  background-color: #5a6a5a;
  color: #f4f4f4;
  font-size: 16px;
  width: 100px;
  text-align: center;
}

/* Restore browser number field controls for roll counters */
input[type="number"] {
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: inner-spin-button;
  opacity: 1;
  height: auto;
  margin: 0;
}

.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Results and History */
.results-section {
  background-color: #2a3a2a;
  border: 1px solid #4a5a4a;
  min-height: 200px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background-color: #3a4a3a;
  margin-bottom: 8px;
  border-radius: 6px;
  border-left: 4px solid #5d6d47;
  min-width: 0;
}

.result-info {
  flex: 1;
  min-width: 0;
  margin-right: 10px;
}

.result-table {
  font-size: 11px;
  color: #9aa99a;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-text {
  font-weight: bold;
  font-size: 14px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.3;
}

.result-details {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.2;
}

.result-table {
  font-size: 14px;
  color: #c4c4c4;
  margin-bottom: 4px;
}

.result-roll {
  color: #a4a4a4;
  font-size: 14px;
  margin-left: 10px;
}

.remove-result {
  background-color: #d32f2f;
  padding: 6px 12px;
  font-size: 12px;
  margin-left: 15px;
}

.empty-results {
  text-align: center;
  color: #a4a4a4;
  font-style: italic;
  padding: 30px;
}

.empty-history {
  color: #d4d4d4;
  font-style: italic;
  text-align: center;
  margin-top: 20px;
}

/* History Components */
.history-container, .links-container {
  background-color: #3a4a3a;
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
  width: 100%;
  max-width: 600px;
}

.history-container {
  max-height: 300px;
}

.history-list {
  max-height: 250px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background-color: #4a5a4a;
  margin-bottom: 5px;
  border-radius: 5px;
}

.history-number {
  color: #f4f4f4;
  font-size: 12px;
  font-weight: bold;
  min-width: 30px;
}

.history-value {
  font-size: 18px;
  font-weight: bold;
  flex: 1;
  text-align: center;
}

.history-type {
  color: #d4d4d4;
  font-size: 12px;
  font-weight: bold;
  min-width: 25px;
  text-align: right;
}

/* Links Components */
.links-container {
  background-color: #3a3a4a;
}

.link-item {
  display: block;
  background-color: #4a4a5a;
  color: #f4f4f4;
  padding: 12px 15px;
  margin-bottom: 8px;
  border-radius: 5px;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.2s;
}

.link-item:hover {
  background-color: #5a5a6a;
  color: #f4f4f4;
}

/* Chit Display (for Initiative Chit Pull) */
.chit-display {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  border: 3px solid #4a4a4a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f4f4f4;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  margin-bottom: 20px;
}

.placeholder-chit {
  background-color: #e0e0e0;
  border-color: #9e9e9e;
}

.small-chit {
  background-color: #f4f4f4;
  border-color: #4a4a4a;
}

.large-chit {
  background-color: #f4f4f4;
  border-color: #4a4a4a;
}

.chit-value {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 4px;
}

.chit-type {
  font-size: 16px;
  font-weight: bold;
}

/* Table View Components */
.table-view-content {
  background-color: #4a5a4a;
  border-radius: 6px;
  padding: 15px;
  margin: 10px 0;
}

.table-description {
  font-size: 16px;
  font-weight: bold;
  color: #e4e4e4;
  margin-bottom: 15px;
  text-align: center;
  padding: 10px;
  background-color: #5a6a5a;
  border-radius: 6px;
}

.nation-section {
  margin-bottom: 15px;
  padding: 12px;
  background-color: #3a4a3a;
  border-radius: 6px;
  border-left: 4px solid #5d6d47;
}

.nation-header {
  font-weight: bold;
  color: #f4f4f4;
  margin-bottom: 8px;
  font-size: 16px;
}

.aircraft-list {
  margin-left: 15px;
}

.aircraft-item {
  color: #d4d4d4;
  margin-bottom: 4px;
  font-size: 14px;
}

/* Navigation */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: #8db4e2;
  text-decoration: none;
  font-weight: bold;
}

.back-link:visited {
  color: #8db4e2;
}

.back-link:hover {
  color: #a4c4f2;
}

.oob-back-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto 32px;
  padding: 0 16px;
}

.oob-back-link {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: none;
  text-decoration: none;
  color: #f5f5f5;
  background: rgba(12, 22, 34, 0.8);
  transition: transform 0.2s ease, border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.oob-back-link:hover {
  transform: translateY(-1px);
}

.oob-back-nav--ba .oob-back-link {
  color: #e6f0ff;
  border-color: rgba(159, 212, 255, 0.5);
  background: linear-gradient(135deg, rgba(76, 102, 122, 0.92), rgba(34, 50, 64, 0.92));
}

.oob-back-nav--ba .oob-back-link:hover {
  background: rgba(122, 154, 170, 0.35);
  border-color: #9fd4ff;
  color: #ffffff;
}

.oob-back-nav--rs .oob-back-link {
  color: #e9f5e5;
  border-color: rgba(126, 168, 126, 0.45);
  background: linear-gradient(135deg, rgba(36, 56, 36, 0.92), rgba(16, 30, 16, 0.92));
}

.oob-back-nav--rs .oob-back-link:hover {
  background: rgba(126, 168, 126, 0.25);
  border-color: #b4ecb4;
  color: #ffffff;
}

/* Layout Helpers */
.button-container {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 400px;
  gap: 20px;
  margin-bottom: 40px;
}

.fixed-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 300px;
  margin-bottom: 40px;
}

.scrollable-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.top-button-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  max-width: 600px;
  margin-bottom: 15px;
  gap: 20px;
}

.bottom-button-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 20px;
}

.result-container {
  margin-bottom: 40px;
}

/* Responsive Design */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }
  
  .table-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .input-group {
    flex-direction: column;
    gap: 10px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .results-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  
  .button-container {
    flex-direction: column;
    align-items: center;
  }
  
  .top-button-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .title {
    font-size: 24px;
  }
}

/* Table C Tasking Styles */
.tasking-section {
  margin-bottom: 25px;
  padding: 15px;
  background-color: #1a2a1a;
  border-radius: 6px;
  border: 1px solid #3a4a3a;
}

.tasking-header {
  font-size: 18px;
  font-weight: bold;
  color: #8fbc8f;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3a4a3a;
}

/* Result Styling for NATO vs Warsaw Pact */
.nato-result {
  background-color: #e3f2fd !important; /* Light blue for NATO results */
  border-left: 4px solid #1976d2 !important;
  color: #0d47a1;
}

.nato-result .result-table {
  color: #0d47a1 !important;
  font-weight: bold;
}

.wp-result {
  background-color: #ffebee !important; /* Light red for Warsaw Pact results */
  border-left: 4px solid #d32f2f !important;
  color: #b71c1c;
}

.wp-result .result-table {
  color: #b71c1c !important;
  font-weight: bold;
}

/* Faction-Specific Table View Styling */

/* Date range headers - blue for NATO, red for WP */
.table-view-modal.nato-table-view .date-range-header {
  background-color: #5e92f3;
  color: #ffffff;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 10px;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
}

.table-view-modal.wp-table-view .date-range-header {
  background-color: #e57373;
  color: #ffffff;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 10px;
  text-align: center;
  padding: 8px;
  border-radius: 6px;
}

/* NATO Table View Styling */
.table-view-modal.nato-table-view {
  background: linear-gradient(135deg, #1e3a5f 0%, #2c4f7c 100%);
  border: 2px solid #4a90e2;
}

.table-view-modal.nato-table-view .table-view-content {
  background-color: transparent;
}

.table-view-modal.nato-table-view .section-title {
  color: #1976d2;
  font-weight: bold;
  font-size: 18px;
  background-color: #e3f2fd;
  color: #0d47a1;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.table-view-modal.nato-table-view .table-description {
  background-color: rgba(227, 242, 253, 0.15);
  color: #e3f2fd;
  border: 1px solid rgba(25, 118, 210, 0.3);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.table-view-modal.nato-table-view .nation-section,
.table-view-modal.nato-table-view .tasking-section,
.table-view-modal.nato-table-view .nationality-section,
.table-view-modal.nato-table-view .mission-section,
.table-view-modal.nato-table-view .flight-type-section {
  background-color: rgba(255, 255, 255, 0.08);
  border-left: 4px solid rgba(25, 118, 210, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.table-view-modal.nato-table-view .nation-header,
.table-view-modal.nato-table-view .tasking-header,
.table-view-modal.nato-table-view .nationality-header,
.table-view-modal.nato-table-view .mission-header,
.table-view-modal.nato-table-view .flight-type-header {
  color: #bbdefb;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.table-view-modal.nato-table-view .aircraft-item {
  color: #e3f2fd;
  font-weight: 400;
  padding: 2px 0;
}

.table-view-modal.nato-table-view .mission-description {
  color: #bbdefb;
  font-style: italic;
}

/* Warsaw Pact Table View Styling */
.table-view-modal.wp-table-view {
  background: linear-gradient(135deg, #4a2020 0%, #5c2a2a 100%);
  border: 2px solid #c62828;
}

.table-view-modal.wp-table-view .table-view-content {
  background-color: transparent;
}

.table-view-modal.wp-table-view .section-title {
  color: #d32f2f;
  font-weight: bold;
  font-size: 18px;
  background-color: #ffebee;
  color: #b71c1c;
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.table-view-modal.wp-table-view .table-description {
  background-color: rgba(255, 235, 238, 0.15);
  color: #ffebee;
  border: 1px solid rgba(211, 47, 47, 0.3);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.table-view-modal.wp-table-view .nation-section,
.table-view-modal.wp-table-view .tasking-section,
.table-view-modal.wp-table-view .nationality-section,
.table-view-modal.wp-table-view .mission-section,
.table-view-modal.wp-table-view .flight-type-section {
  background-color: rgba(255, 255, 255, 0.08);
  border-left: 4px solid rgba(211, 47, 47, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.table-view-modal.wp-table-view .nation-header,
.table-view-modal.wp-table-view .tasking-header,
.table-view-modal.wp-table-view .nationality-header,
.table-view-modal.wp-table-view .mission-header,
.table-view-modal.wp-table-view .flight-type-header {
  color: #ffcdd2;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.table-view-modal.wp-table-view .aircraft-item {
  color: #ffebee;
  font-weight: 400;
  padding: 2px 0;
}

.table-view-modal.wp-table-view .mission-description {
  color: #ffcdd2;
  font-style: italic;
}

/* Legacy Warsaw Pact styles for backward compatibility */
.nationality-section {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #1a2a1a;
  border-radius: 6px;
  border: 1px solid #3a4a3a;
}

.nationality-header {
  font-size: 18px;
  font-weight: bold;
  color: #ff9999;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3a4a3a;
}

.flight-type-section {
  margin-bottom: 15px;
  padding: 10px;
  background-color: #0f1f0f;
  border-radius: 4px;
}

.flight-type-header {
  font-size: 16px;
  font-weight: bold;
  color: #cc8888;
  margin-bottom: 10px;
}

.mission-section {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #1a2a1a;
  border-radius: 6px;
  border: 1px solid #3a4a3a;
}

.mission-header {
  font-size: 18px;
  font-weight: bold;
  color: #ff9999;
  margin-bottom: 8px;
}

.mission-description {
  font-size: 14px;
  color: #b4c4b4;
  margin-bottom: 15px;
  font-style: italic;
}
/* CSAR Flight Card Grid Layout */
.csar-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  page-break-inside: avoid;
  margin-bottom: 8px;
}

.compact-csar-card {
  width: 100%;
  height: 130pt;
  page-break-inside: avoid;
  border: 2px solid black;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font-size: 6pt;
  line-height: 1.1;
  background: white;
  color: black;
  padding: 2px;
}

.compact-damage-label {
  font-size: 6pt;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  flex: 1;
}

.damage-checkbox-compact {
  min-width: 12px;
  min-height: 12px;
  width: 12px;
  height: 12px;
  border: 1px solid #666;
  background: white;
  flex-shrink: 0;
}
