/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Header ===== */
header {
  background: linear-gradient(135deg, #2c5f2d, #4a7c4b);
  color: #fff;
  text-align: center;
  padding: 1.5rem 1rem;
}

header h1 {
  font-family: "Oswald", "Bitter", sans-serif;
  font-size: 2.4rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

header p {
  font-size: 0.95rem;
  opacity: 0.85;
}

/* ===== Main ===== */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

section h2 {
  font-family: "Bitter", Georgia, serif;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #2c5f2d;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 0.4rem;
}

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #555;
}

.form-group input,
.form-group select {
  padding: 0.55rem 0.7rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4a7c4b;
  box-shadow: 0 0 0 2px rgba(74, 124, 75, 0.15);
}

.form-group input[readonly] {
  background: #e8f5e9;
  cursor: default;
}

.dont-know-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #888;
  cursor: pointer;
  user-select: none;
}

.dont-know-check input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

.form-group input.disabled-field {
  background: #f5f5f5;
  color: #aaa;
  cursor: not-allowed;
}

/* ===== Buttons ===== */
.btn {
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: #2c5f2d;
  color: #fff;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: #3a7d3c;
}

.btn-sort {
  background: #e0e0e0;
  color: #333;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn-sort:hover {
  background: #ccc;
}

.btn-sort.active {
  background: #2c5f2d;
  color: #fff;
}

.btn-small {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 4px;
}

.btn-report {
  background: #1565c0;
  color: #fff;
}

.btn-report:hover {
  background: #1976d2;
}

.btn-delete {
  background: #c62828;
  color: #fff;
}

.btn-delete:hover {
  background: #d32f2f;
}

.btn-edit {
  background: #1565c0;
  color: #fff;
}

.btn-edit:hover {
  background: #1976d2;
}

/* ===== Sort Buttons ===== */
.sort-buttons {
  display: flex;
  flex-wrap: wrap;
}

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #f8faf8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c5f2d;
}

/* ===== Comparison ===== */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.comparison-card {
  background: #f8faf8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}

.comp-label {
  display: block;
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.comp-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.3rem;
}

.comp-status {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.comp-status.above {
  background: #c8e6c9;
  color: #2e7d32;
}

.comp-status.average {
  background: #fff9c4;
  color: #9e7c00;
}

.comp-status.below {
  background: #ffcdd2;
  color: #c62828;
}

/* ===== Table ===== */
.table-section {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead {
  background: #2c5f2d;
  color: #fff;
}

th, td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
  background: #f0f7f0;
}

tbody tr.top-scout {
  background: #fff9c4;
  font-weight: 600;
}

tbody tr.top-scout td:first-child::before {
  content: "\1F3C6 ";
}

.flag-low {
  display: inline-block;
  background: #ffcdd2;
  color: #c62828;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  margin-left: 0.3rem;
  font-weight: 600;
}

.flag-eagle-ready {
  display: inline-block;
  background: #c8e6c9;
  color: #2e7d32;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  margin-left: 0.3rem;
  font-weight: 600;
}

.no-data {
  text-align: center;
  color: #999;
  padding: 2rem 0;
  font-style: italic;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

/* ===== Report Content ===== */
.report {
  text-align: center;
}

.report-header {
  background: #2c5f2d;
  color: #fff;
  padding: 1.2rem;
  border-radius: 6px;
  margin-bottom: 1.2rem;
}

.report-header h3 {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.report-header p {
  opacity: 0.85;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.report-body {
  text-align: left;
}

.report-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.report-row .label {
  color: #777;
  font-size: 0.9rem;
}

.report-row .value {
  font-weight: 600;
  color: #333;
}

.report-title-box {
  margin: 1.2rem 0;
  padding: 1rem;
  background: #e8f5e9;
  border-radius: 6px;
  text-align: center;
}

.report-title-box .title-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #777;
}

.report-title-box .title-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #2c5f2d;
}

.report-message {
  text-align: center;
  font-style: italic;
  color: #555;
  margin-top: 0.8rem;
  font-size: 0.95rem;
}

/* ===== Confirm Modal ===== */
.modal-confirm {
  max-width: 380px;
  text-align: center;
}

.modal-confirm h3 {
  margin-bottom: 0.5rem;
  color: #333;
}

.modal-confirm p {
  color: #666;
  margin-bottom: 1rem;
}

.modal-confirm input[type="password"] {
  width: 100%;
  padding: 0.7rem;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 0.5rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.modal-confirm input[type="password"]:focus {
  outline: none;
  border-color: #c62828;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.15);
}

.confirm-error {
  color: #c62828;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.confirm-buttons {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 1rem;
}

.btn-cancel {
  background: #e0e0e0;
  color: #333;
}

.btn-cancel:hover {
  background: #ccc;
}

.btn-danger {
  background: #c62828;
  color: #fff;
}

.btn-danger:hover {
  background: #d32f2f;
}

/* ===== Edit Modal ===== */
.modal-edit {
  max-width: 600px;
}

.modal-edit h3 {
  margin-bottom: 1rem;
  color: #2c5f2d;
}

.hidden {
  display: none;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 1rem;
  color: #999;
  font-size: 0.8rem;
}

/* ===== Print ===== */
@media print {
  header, footer, .form-section, .stats-section, .comparison-section,
  .sort-section, .table-section, .modal-close, #printReport {
    display: none !important;
  }

  .modal {
    position: static;
    background: none;
    padding: 0;
  }

  .modal-content {
    box-shadow: none;
    padding: 0;
    max-height: none;
    overflow: visible;
  }

  .report-header {
    background: #2c5f2d !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
