/* Import modal + helpers from entertainment styles (modal rules live there) */
@import url('entertainment-licenses-style.css');

/* Basic layout for Licenses page */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color: #111;
  margin: 24px;
}

/* Override/ensure modal is centered and its content scrolls properly */
#howToModal.modal-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none; /* shown via inline style (display:flex) when opened */
  align-items: center;
  justify-content: center;
  background: rgba(2,6,23,0.55);
  padding: 20px;
  z-index: 1000;
}

.modal-backdrop .modal,
#howToModal .modal {
  background: #fff;
  border-radius: 10px;
  max-width: 820px;
  width: 100%;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.2);
  max-height: calc(100vh - 120px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Make modal body scrollable independently of page */
#howToBody {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

/* Ensure close button is visible and aligned */
#howToClose { margin-left: 12px; }

:root {
  --boston-navy: #0b2340;
  --boston-mid: #123a5b;
  --boston-light: #f6f8fb;
  --boston-red: #c62828;
  --boston-muted: #475b6a;
  --desc-muted: #6b7280;
}

/* Top banner with City of Boston logo */
.top-banner {
  background: #ffffff;
  margin: -24px -24px 12px -24px;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(11,35,64,0.06);
}
.city-logo {
  height: 72px;
  width: auto;
  display: block;
}

/* About button placed at same vertical height as logo */
.about-btn {
  background: var(--boston-mid);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  height: 40px;
}
.about-btn:hover { background: #0f456b; }

/* Small variant used for 'More...' header buttons */
.more-btn {
  background: var(--boston-mid);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  height: 32px;
  border: none;
  cursor: pointer;
}
.more-btn:hover { background: #0f456b; }

/* disclaimer in top banner, right-aligned */
.disclaimer-banner {
  background: var(--boston-red);
  color: #fff;
  margin: 0 -24px 12px -24px;
  padding: 10px 24px;
}
.disclaimer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}
.disclaimer-content .disclaimer-label { font-weight: 800; font-size: 1.2rem; }
.disclaimer-content .disclaimer-body { font-size: 1rem; }

@media (max-width: 720px) {
  .disclaimer-content { flex-direction: column; gap: 6px; }
  .disclaimer-content .disclaimer-label { font-size: 1rem; }
  .disclaimer-content .disclaimer-body { font-size: 0.95rem; text-align: center; }
}

/* Section headings like 'Licenses Checklist' and the summary title use the mid blue */
.checklist h2,
.summary h2 {
  color: var(--boston-mid);
  margin: 0 0 12px 0;
}

.container {
  display: grid;
  grid-template-columns: 1fr 520px;
  gap: 20px;
  align-items: start;
}

textarea#definitions-json {
  width: 100%;
  height: 280px;
  font-family: monospace;
  font-size: 13px;
  padding: 8px;
  box-sizing: border-box;
}

.buttons {
  margin-top: 8px;
}

button {
  padding: 8px 12px;
  margin-right: 8px;
}

#licenses-list {
  border: 1px solid #ddd;
  padding: 12px;
  min-height: 120px;
}

.license-row {
  border-bottom: 1px solid #f0f0f0;
  padding: 10px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}
.selected-group-title { list-style: none; margin-top: 8px; margin-bottom: 4px; }
.selected-group-title strong { font-size: 0.98rem; color: var(--boston-red); }
.selected-group-title .group-count { background: var(--boston-mid); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 0.8rem; margin-left: 8px; }
/* subtotal line below group items inside the selected list */
.selected-group-subtotal { color: var(--desc-muted); margin: 6px 0 12px 0; font-size: 0.95rem; font-weight: 600; text-align: left; }
.selected-group-divider { list-style: none; height: 1px; background: #eee; margin: 6px 0; padding: 0; }
.selected-item { margin: 0 0 4px 0; padding: 0; }

/* remove default list bullets and left padding from the selected list */
#selected-list { list-style: none; padding: 0; margin: 0; }

.license-category h3 {
  margin: 18px 0 6px 0;
  font-size: 1.05rem;
  color: var(--boston-navy);
}

/* Section wrappers inside the licenses list */
.licenses-section { margin-bottom: 18px; border-radius: 6px; padding: 6px 0; }
.licenses-section-heading { margin: 6px 0 8px 0; font-size: 1rem; color: var(--boston-red); }
.licenses-section-content { display: block; padding-left: 0; }

header h1 {
  color: #fff;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.02;
  margin: 0 0 8px 0;
}

header {
  background: var(--boston-navy);
  color: #fff;
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 18px;
}

header a { color: rgba(255,255,255,0.95); }

.license-category .muted {
  margin-bottom: 8px;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--boston-light);
  padding: 8px 10px;
  border-radius: 8px;
}

/* left column inside header: title + description stacked vertically */
.category-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* description visible under the heading even when collapsed */
.category-desc {
  margin: 0;
  color: var(--desc-muted);
  font-size: 0.95rem;
  line-height: 1.2;
  opacity: 0.95;
}

/* Allow left column to shrink and wrap so controls don't overlap */
.category-header-left {
  flex: 1 1 auto;
  min-width: 0; /* important for flex children to be able to shrink */
  padding-right: 12px; /* give breathing room before the controls */
}
.category-controls { flex: 0 0 auto; }
.category-desc { overflow-wrap: break-word; word-break: break-word; hyphens: auto; }

.category-header-left h3 {
  margin: 0;
  color: var(--boston-navy);
  font-size: 1rem;
}

/* make header indicate clickability */
.category-header { cursor: pointer; }

.category-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.category-items {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 280ms ease, opacity 200ms ease;
  opacity: 1;
}

.category-items.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

/* space between category boxes so blue header boxes don't touch */
.license-category {
  margin-bottom: 12px;
}

.category-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none; /* remove visual border so it blends into header */
  background: transparent; /* blend into header background */
  color: var(--boston-red); /* Boston red accent */
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.category-toggle svg { display: block; }
.category-toggle:focus { outline: 2px solid rgba(198,40,40,0.18); }
.category-toggle:hover { background: rgba(198,40,40,0.06); transform: translateY(-1px); }

.license-meta {
  flex: 1 1 auto;
}

/* small, borderless table for tiered capacity fees */
.tier-table {
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1;
  width: auto;
}
.tier-table th {
  text-align: left;
  font-weight: 600;
  padding: 2px 6px;
  color: #0b2340;
}
.tier-table td {
  padding: 2px 6px;
  color: #333;
}
.tier-table td:first-child { min-width: 64px; }
.tier-table td:last-child { text-align: right; white-space: nowrap; }
.tier-table tr + tr td { padding-top: 2px; }

.license-controls input[type="number"] {
  width: 80px;
}

.summary .total {
  margin-top: 12px;
  font-weight: 600;
}

/* keep the selected licenses / total visible as user scrolls */
.summary {
  position: sticky;
  top: 20px;
  align-self: start;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: #fff;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Summary controls (toggle button area) */
.summary-controls { display: flex; justify-content: flex-start; align-items: center; gap: 8px; margin-top: 8px; }

/* Fees Reform Modal Custom Styles */
#feesReformModal .modal {
  max-width: 600px;
  padding: 24px 24px 18px 24px;
}
#feesReformBody table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
}
#feesReformBody th, #feesReformBody td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
}
#feesReformBody th {
  background: #f6f8fb;
  text-align: left;
  font-weight: 700;
}
#feesReformBody td {
  font-size: 1rem;
}
#feesReformBody tr:last-child td {
  border-bottom: none;
}

.reset-btn { background: transparent; border: 1px solid var(--boston-mid); color: var(--boston-mid); padding: 6px 8px; border-radius: 6px; margin-left: 8px; cursor: pointer; }
.reset-btn:hover { background: var(--boston-mid); color: #fff; }
.remove-selected-btn { background: transparent; border: 1px solid var(--boston-mid); color: var(--boston-mid); padding: 6px 8px; border-radius: 6px; margin-left: 8px; cursor: pointer; }
.remove-selected-btn:hover { background: var(--boston-mid); color: #fff; }
.selected-list-checkbox { margin-right: 8px; transform: translateY(-1px); }

/* Collapsible selected-area (keeps howto-panel separate) */
.selected-area { transition: max-height 220ms ease; flex: 0 0 auto; }
.selected-area.collapsed { max-height: 56px; overflow: hidden; }

/* inner wrapper that holds the UL selected-list; collapsing this does not affect .total */
.selected-list {
  transition: max-height 220ms ease, opacity 180ms ease;
  max-height: 60vh; /* allow the list to scroll internally when expanded */
  overflow: auto;
}
.selected-list.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.howto-panel { margin-bottom: 12px; padding: 12px; border-radius: 8px; background: var(--boston-light); border: 1px solid #f0f0f0; display: flex; flex-direction: column; }
.howto-panel h3 { margin: 0 0 6px 0; }

/* howto header and close button */
.howto-header { display: flex; flex-direction: column; gap: 6px; }
.howto-header > div { display:flex; justify-content:space-between; align-items:center; }
.howto-close { background: var(--boston-mid); color: #fff; border: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.howto-close:focus { outline: 2px solid rgba(18,58,91,0.18); }
.howto-body { flex: 1 1 auto; overflow: auto; }

/* Align and enlarge how-to heading and subtitle */
.howto-header h3, .howto-header #howto-title { text-align: left; font-size: 1.6rem; margin: 0; font-weight: 800; color: var(--boston-navy); }
.howto-subtitle { text-align: left; font-size: 1.25rem; margin: 0; color: var(--boston-muted); font-weight: 700; }


.muted { color: var(--boston-muted); font-size: 13px; }

/* item descriptions inside license-meta should be more faded */
.license-meta .muted { color: var(--desc-muted); }

/* gentle inline prompt for quantity-required items */
.qty-prompt {
  display: none;
  margin-top: 6px;
  color: var(--boston-mid);
  font-size: 0.92rem;
  background: rgba(18,58,91,0.05);
  padding: 6px 8px;
  border-radius: 6px;
}
.qty-prompt.visible { display: block; }

@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
}

/* Keep summary visible on narrower viewports by fixing it to the side or bottom */
@media (max-width: 900px) {
  .summary {
    position: fixed;
    right: 12px;
    top: 12px;
    width: 300px;
    max-width: 40vw;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  /* add right padding so content isn't hidden under the fixed summary */
  .container { padding-right: 336px; }
}

@media (max-width: 480px) {
  .summary {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: none;
    border-radius: 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  }
  /* add bottom padding so content can scroll above the bottom sheet */
  .container { padding-right: 0; padding-bottom: 260px; }
}

/* main two-column layout: adjust the second value to change the sidebar width */
main.container {
  display: grid;
  grid-template-columns: 1fr 800px; /* left = checklist, right = summary/how-to */
  gap: 24px;
}

/* ensure the how-to panel sits in the right column only */
#howto-panel,
.howto-panel {
  /* place the how-to inside the summary column and let it fill remaining space */
  width: 100%;
  max-width: 100%;
  margin-top: 12px;
  flex: 1 1 auto;
  overflow: auto;
}

.howto-body { overflow: auto; }
