/* ==========================================================================
   Judicial Assignments & Court Calendars
   Matches jcc_components design tokens:
     blue   #005ea2   (links, active states, table headers)
     dark   #1b2b85   (headings)
     grey   #494849   (body text)
     border #dfe1e2
   WCAG 2.1 AA: all colour pairs ≥ 4.5 : 1.
   ========================================================================== */

/* --- Tabs (WAI-ARIA Tabs pattern) --- */
.jcc-ja-tabs {
  display: flex;
  border-bottom: 2px solid #dfe1e2;
  margin-bottom: 1.5rem;
  gap: 0;
}

.jcc-ja-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #005ea2;
  cursor: pointer;
  position: relative;
  bottom: -2px; /* overlap container border */
  transition: border-color 0.15s, background-color 0.15s;
}

.jcc-ja-tab:hover {
  background-color: #e8f1f8;
  border-bottom-color: #005ea2;
}

.jcc-ja-tab--active {
  color: #1b2b85;
  border-bottom-color: #005ea2;
}

.jcc-ja-tab:focus-visible {
  outline: 3px solid #005ea2;
  outline-offset: 2px;
}

/* --- Panels --- */
.jcc-ja-panel {
  /* no padding – controls add their own */
}

/* --- Controls row --- */
.jcc-ja-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.jcc-ja-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.jcc-ja-control-group label {
  font-weight: 700;
  font-size: 0.875rem;
  color: #1b2b85;
}

.jcc-ja-control-group select,
.jcc-ja-control-group input[type="date"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid #a2a6ab;
  border-radius: 4px;
  font-size: 1rem;
  min-width: 160px;
}

.jcc-ja-control-group select:focus,
.jcc-ja-control-group input[type="date"]:focus {
  outline: 3px solid #005ea2;
  outline-offset: 2px;
  border-color: #005ea2;
}

/* --- Week header --- */
.jcc-ja-header {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1b2b85;
  margin-bottom: 1rem;
}

/* --- Table wrapper (horizontal scroll on small screens) --- */
.jcc-ja-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}

/* --- Calendar table --- */
.jcc-ja-calendar {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
  background: #fff;
  table-layout: fixed;
}

/* Visually-hidden caption – read by screen readers */
.jcc-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* thead – blue header (white-on-blue ≈ 8.6 : 1) */
.jcc-ja-calendar thead {
  background: #005ea2;
  color: #fff;
}

.jcc-ja-calendar thead th {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.jcc-ja-calendar thead th.jcc-ja-col-dept {
  width: 75px;
}

/* Sub-header row with dates */
.jcc-ja-calendar .jcc-ja-subheader {
  background: #dae2eb;
}

.jcc-ja-calendar .jcc-ja-subheader td {
  padding: 0.375rem 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1b2b85;
  border: 1px solid #c5cfd8;
}

/* Department cell (rowspan) */
.jcc-ja-dept-cell {
  background: #f5f5f5;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1b2b85;
  border: 1px solid #dfe1e2;
  padding: 0.75rem 0.5rem;
  vertical-align: top;
}

/* Schedule cells */
.jcc-ja-cell {
  vertical-align: top;
  padding: 0.5rem;
  border: 1px solid #dfe1e2;
  min-height: 100px;
}

.jcc-ja-cell--down {
  background: #f5f5f5;
  border: 1px solid #dfe1e2;
  min-height: 100px;
}

/* AM / PM label */
.jcc-ja-ampm {
  display: block;
  font-weight: 700;
  font-size: 0.875rem;
  color: #005ea2;
  margin-bottom: 0.25rem;
}

/* Judge names – underlined for visual emphasis (matches original) */
.jcc-ja-judges {
  font-weight: 600;
  text-decoration: underline;
  color: #1b2b85;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

/* Docket list inside cells */
.jcc-ja-dockets {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.875rem;
  color: #494849;
}

.jcc-ja-dockets li {
  padding: 0.125rem 0;
}

/* Notice row (amber) – dark-on-light ≈ 7.2 : 1 */
.jcc-ja-notice {
  padding: 0.75rem 1rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  font-size: 0.9375rem;
}

.jcc-ja-notice strong {
  color: #856404;
}

/* Phone row */
.jcc-ja-phone {
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  border-top: 1px solid #dfe1e2;
  font-size: 0.9375rem;
}

.jcc-ja-phone a {
  color: #005ea2;
}

.jcc-ja-phone a:hover {
  color: #004080;
}

.jcc-ja-phone a:focus-visible {
  outline: 3px solid #005ea2;
  outline-offset: 2px;
}

/* --- Judicial Assignments list --- */
.jcc-ja-assignments {
  padding: 0;
  margin: 0;
}

.jcc-ja-assignment {
  border-bottom: 1px solid #dfe1e2;
  padding: 1rem 0;
}

.jcc-ja-assignment:last-child {
  border-bottom: none;
}

.jcc-ja-assignment__dept {
  font-size: 1.125rem;
  font-weight: 700;
  color: #005ea2;
  margin-bottom: 0.5rem;
}

.jcc-ja-assignment__dockets {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
  color: #494849;
  font-size: 0.9375rem;
}

.jcc-ja-assignment__dockets li {
  padding: 0.125rem 0;
}

/* --- Loading / error / empty states --- */
.jcc-ja-loading {
  color: #494849;
  font-style: italic;
  padding: 1rem 0;
}

.jcc-ja-error {
  color: #d63e04;
  background: #fef0ec;
  border: 1px solid #d63e04;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
}

.jcc-ja-empty {
  color: #494849;
  font-style: italic;
}

/* --- Responsive --- */
@media screen and (max-width: 640px) {
  .jcc-ja-tabs {
    flex-direction: column;
    border-bottom: none;
  }

  .jcc-ja-tab {
    bottom: 0;
    border-left: 3px solid transparent;
    border-bottom: none;
    text-align: left;
  }

  .jcc-ja-tab--active {
    border-left-color: #005ea2;
  }

  .jcc-ja-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .jcc-ja-cell {
    min-height: 80px;
  }
}

/* --- High-contrast mode --- */
@media (prefers-contrast: high) {
  .jcc-ja-tab--active {
    border-bottom-width: 4px;
  }

  .jcc-ja-calendar thead {
    background: #000;
  }

  .jcc-ja-error {
    border-width: 2px;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .jcc-ja-tab {
    transition: none !important;
  }
}
