/* =====================================================
   Base Reset & Typography
   ===================================================== */

body {
  background: #fffff8;
  color: #400561;
  font-family: Georgia, serif;
  margin: 0;
  padding: 1rem;
  line-height: 1.5;
}

h1, h2 {
  margin: 0;
  font-family: 'ChunkFive', Georgia, serif;
}

h1 {
  font-size: 2.2rem;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

@media (max-width: 500px) {
  h1 { font-size: 1.7rem; }
}

/* =====================================================
   Form Controls & Layout
   ===================================================== */
   
form#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;

}
form#controls > * {
  flex: 1 1 200px;

}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

/* Standard inputs, selects, buttons */
#controls input,
#controls select,
#controls button {
  width: 100%;
  padding: .5rem;
  font-size: 1rem;
}

#controls button {
  background: #7c3626;
  color: #fff;
  border: none;
  cursor: pointer;
}

#controls button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Inline field wrapper (number + unit) */
.inline-field {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
}

.inline-field input {
  width: 6rem;
}

/* Segmented buttons (mode & structure) */
/* specify #main to give enough priority over the #main button stuff */
#controls .seg {
  display: inline-block;
  position: relative;
  margin-right: .5rem;
}

#controls .seg input {
  position: absolute;
  opacity: 0;
}

#controls .seg span {
  display: inline-block;
  padding: .5rem 1rem;
  border: 2px solid #40056160;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  white-space: nowrap;
}

#controls .seg input:checked + span {
  background: #400561;
  color: #fffff8;
  border-color: #400561;
}

#controls .seg input:disabled + span {
  opacity: .4;
  cursor: not-allowed;
}

/* Chip buttons (Today / Jan 1) */
#controls .chip {
  display: inline-block;
  padding: .4rem .9rem;
  width: 100%;
  border: 1px solid #400561;
  border-radius: 999px;
  background: #40056120;
  color: #400561;
  cursor: pointer;
  margin-right: .5rem;
  text-align: center;
}

#controls .chip:hover { background: #40056130; }
#controls .chip:active{ background: #400561; color: #fffff8; }

/* =====================================================
   Card-Based Layout & Headers
   ===================================================== */

.card {
  background: #fffff8;
  border: 2px solid #40056120;
  border-radius: .5rem;
  padding: 1rem 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant: small-caps;
  letter-spacing: 1px;
  margin-bottom: .75rem;
  position: relative;
}

.card h2::after {
  content: '';
  display: block;
  width: 2.5rem;
  height: 3px;
  background: #7c3626;
  margin-top: .25rem;
}

/* Grid utilities */
.grid      { display: grid; gap: .75rem 1.25rem; }
.one-col   { grid-template-columns: 1fr; }
.two-col   { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }

@media (max-width: 600px) {
  .two-col { grid-template-columns: 1fr; }
}


/* =====================================================
   Header & Actions
   ===================================================== */

.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #400561;
  margin: 1rem 0;
}

.plan-header h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-header h1#printTitle {
  display: none;
}

.header-logo {
  display: none;
  height: 2rem;
  width: auto;
}

/* Action buttons container */
#actions {
  text-align: right;
  margin: 1rem 0;
}

#actions button {
  background: #7c3626;
  color: #fff;
  font-size: 1.25rem;
  padding: .75rem 1.5rem;
  border: none;
  cursor: pointer;
}

#actions button + button {
  margin-left: .5rem;
}

/* Generate Plan specific */
#generate {
  display: flex;
  align-items: center;
  justify-content: center;
}

#generate button {
  width: 100%;
  max-width: 200px;
  padding: .8rem 1rem;
  font-size: 1.2rem;
}

/* =====================================================
   Table & Plan Output
   ===================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

thead {
  background: #400561;
  color: #fff;
}

#plan thead th {
  padding: .75rem .5rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: .9rem;
}

th, td {
  padding: .5rem;
  border: 1px solid #ddd;
}

tbody tr:nth-child(odd) {
  background: #f9f9f9;
}

.passage-segment {
  white-space: nowrap;
}

/* Hide final checkbox column on small screens */
@media (max-width: 500px) {
  #plan thead th:last-child,
  #plan tbody td:last-child {
    display: none;
  }
}

#planInfo {
  background: #40056105;
  border-left: 4px solid #400561;
  border-radius: 4px;
  padding: 0.6rem 1rem;
  margin: 0.75rem 0 1rem;
  font-style: italic;
  color: #400561;
}

/* =====================================================
   Misc Print Styles
   ===================================================== */

@media print {
  /* Hide controls & action buttons */
  form#controls, #actions {
    display: none !important;
  }

  /* Logo & print‐specific title */
  .plan-header h1#planTitle { display: none; }
  .plan-header h1#printTitle{ display: block; }
  .header-logo               { display: block; }

  /* Checkbox scaling */
  input[type="checkbox"] {
    transform: scale(1.5);
  }

  /* Table page-break management */
  table {
    page-break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }

  /* Text sizing */
  #plan td {
    font-size: 12pt;
  }
}
