/* Sidebar */
.sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 200px;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  transition: width 0.2s ease;
  z-index: 1040;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed {
  width: 56px;
}
.sidebar:not(.collapsed) {
  cursor: default;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding-top: 0.5rem;
  flex: 1;
}
.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border: none;
  background: none;
  color: #6c757d;
  cursor: pointer;
  border-top: 1px solid #dee2e6;
  transition: color 0.15s;
}
.sidebar-toggle-btn:hover {
  color: #212529;
  background: #e9ecef;
}
.sidebar:not(.collapsed) .sidebar-toggle-btn i {
  transform: rotate(180deg);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #495057;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
  background: #e9ecef;
  color: #212529;
}
.sidebar-link.active {
  background: #0d6efd;
  color: #fff;
}
.sidebar-link i {
  font-size: 1.2rem;
  min-width: 24px;
  text-align: center;
}
.sidebar-label {
  opacity: 1;
  transition: opacity 0.2s;
}
.sidebar.collapsed .sidebar-label {
  opacity: 0;
  pointer-events: none;
}

/* Main content */
.main-content {
  margin-top: 56px;
  margin-left: 56px;
  padding: 1.5rem;
  transition: margin-left 0.2s ease;
}
.sidebar:not(.collapsed) ~ .main-content {
  margin-left: 200px;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 200px !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0) !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
}

/* Dark theme */
[data-theme="dark"] {
  --bs-body-bg: #1a1d21;
  --bs-body-color: #dee2e6;
}
[data-theme="dark"] body { background: #1a1d21; color: #dee2e6; }
[data-theme="dark"] .navbar { background: #212529 !important; border-color: #343a40 !important; }
[data-theme="dark"] .navbar-brand, [data-theme="dark"] .navbar .text-dark { color: #fff !important; }
[data-theme="dark"] .navbar .text-muted { color: #adb5bd !important; }
[data-theme="dark"] .sidebar { background: #212529; border-color: #343a40; }
[data-theme="dark"] .sidebar-link { color: #adb5bd; }
[data-theme="dark"] .sidebar-link:hover { background: #343a40; color: #fff; }
[data-theme="dark"] .sidebar-toggle-btn { color: #adb5bd; border-color: #343a40; }
[data-theme="dark"] .sidebar-toggle-btn:hover { background: #343a40; color: #fff; }
[data-theme="dark"] .card { background: #2b3035; border-color: #343a40; color: #dee2e6; }
[data-theme="dark"] .table { color: #dee2e6; }
[data-theme="dark"] .alert-info { background: #1e3a5f; border-color: #2a4a6b; color: #a8d4f7; }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background: #2b3035; border-color: #495057; color: #dee2e6; }

/* Weeks container */
.weeks-container {
  display: flex;
  overflow: auto;
  gap: 8px;
  padding-bottom: 140px;
  scroll-behavior: smooth;
}
@media (max-width: 768px) {
  .weeks-container { overflow-x: hidden; }
  .weeks-container input[type="number"] { width: 40px !important; -moz-appearance: textfield; }
  .weeks-container input[type="number"]::-webkit-inner-spin-button,
  .weeks-container input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
}
.week-card-collapsed:hover {
  border-color: #0d6efd !important;
}

/* Fullscreen mode */
.fullscreen-mode {
  position: fixed !important;
  inset: 0;
  z-index: 1045;
  margin: 0 !important;
  padding: 1rem !important;
  background: var(--bs-body-bg, #f8f9fa);
  overflow-y: auto;
}
.fullscreen-mode .weeks-container { justify-content: center; }
.fullscreen-mode .week-card-collapsed { display: none; }
.fullscreen-mode .week-card-expanded { min-width: 100% !important; max-width: 600px !important; }

/* Mobile collapsed cards */
@media (max-width: 768px) {
  .week-card-collapsed { display: none; }
  .week-card-expanded { min-width: 100% !important; max-width: 100% !important; }
}

/* Print */
.form-control-sm, .form-select-sm {
  font-size: 0.875rem !important;
}

@media print {
  body > *:not(#overlay) { display: none !important; }
  #overlay { position: static !important; width: 100% !important; height: auto !important; overflow: visible !important; padding: 0 !important; }
  #overlay > .p-3, #overlay > .p-md-5 { padding: 0 !important; }
  .no-print { display: none !important; }
  @page { margin: 0.4in; size: letter; }
  .stand-copy { max-width: 100% !important; font-size: 12px !important; }
}



/* Custom button outlines matching block colors */
.btn-outline-purple { color: #6f42c1; border-color: #6f42c1; }
.btn-outline-purple:hover { background: #6f42c1; color: #fff; }
.btn-outline-orange { color: #e67e22; border-color: #e67e22; }
.btn-outline-orange:hover { background: #e67e22; color: #fff; }

/* Quick Edit cards */
.week-card-qe {
  min-width: 200px;
  max-width: 200px;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: visible;
}
.week-card-qe:hover { border-color: #0d6efd !important; }
.week-card-qe:hover .qe-lcr-float { border-color: #0d6efd !important; }
.qe-lcr-float {
  position: absolute;
  top: 100%;
  left: -1px;
  right: -1px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.125);
  border-top: none;
  border-radius: 0 0 .375rem .375rem;
  padding: 6px 8px;
  z-index: 1;
  max-height: 120px;
  overflow-y: auto;
}
.week-card-qe:has(.qe-lcr-float) {
  border-radius: .375rem .375rem 0 0;
}
.qe-lcr-float.border-primary {
  border-color: var(--bs-primary) !important;
  border-top: none !important;
}
.qe-section {
  border-bottom: 1px solid #e9ecef;
  padding: 4px 6px;
}
.qe-section:last-child { border-bottom: none; }
.qe-section-program { flex: 1; }
.qe-section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #adb5bd;
  font-weight: 600;
  margin-bottom: 1px;
}
.qe-block-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  font-size: 14px;
  color: #6c757d;
}
.qe-block-row i { font-size: 12px; flex-shrink: 0; width: 14px; text-align: center; }
.qe-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-input-num {
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 1px 3px;
  font-size: 13px;
  width: 36px;
  text-align: center;
  outline: none;
}
.qe-input-num:focus { border-color: #6f42c1; box-shadow: 0 0 0 2px rgba(111,66,193,0.15); }
.qe-input-name {
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  outline: none;
}
.qe-input-name:focus { border-color: #0d6efd; box-shadow: 0 0 0 2px rgba(13,110,253,0.15); }
.qe-hymn-title { font-size: 12px; color: #6f42c1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Quick Edit: align-items stretch so cards match tallest */
.weeks-container { align-items: stretch; }
.weeks-container .week-card-qe, .weeks-container .week-card-expanded { align-self: stretch; }
