/* Path: /indicators/css/calendar.css */
/*
  Scanner-like mini calendar styles for indicators.

  Notes:
  - Kept .calendar-container wrapper to preserve existing layout expectations.
  - Added .cal / .cal__* styles (Scanner mini calendar markup).
  - Added range highlighting classes used by /indicators/js/calendar.js.
*/

.calendar-container {
  background: #101726;
  border: 1px solid #2b3a57;
  border-radius: 12px;
  padding: 10px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  box-sizing: border-box;
}

.calendar-container--panel {
  background: var(--card-color, #162236);
  border: none;
  border-radius: 16px;
  padding: 20px;
  max-width: 500px;
  min-width: 400px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Local buttons inside calendar header (not the whole site) */
.calendar-container .button {
  background: var(--accent-color, #2c64d5);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 12px;
  transition: background .3s ease, opacity .2s ease;
}

.calendar-container .button:hover {
  background: var(--accent-hover-color, #3a78ec);
}

.calendar-container .button:disabled {
  opacity: .45;
  cursor: default;
}

.calendar-miniWrap {
  display: flex;
  justify-content: center;
}

.calendar-rangeLabel {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary-color, #a0cfff);
  opacity: 0.95;
}

.load-btn {
  margin-top: 14px;
  width: 100%;
}

/* === Scanner-like mini calendar === */

.cal {
  width: 100%;
  max-width: 420px;
}

.cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.cal__title {
  font-size: 13px;
  font-weight: 800;
  color: #e5f2ff;
  letter-spacing: 0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal__titleBtn {
  background: transparent;
  border: none;
  height: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  line-height: 1;
  font: inherit;
  color: inherit;
}

.cal__titleBtn:hover {
  background: #243b5a;
}

.cal__titleBtn:active {
  transform: translateY(1px);
}

.cal__titleBtn:focus-visible {
  outline: 2px solid rgba(160, 207, 255, 0.55);
  outline-offset: 2px;
}

.cal__nav {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.calendar-container .cal__head {
  flex-wrap: nowrap;
}

.calendar-container .cal__nav {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 6px;
  flex-shrink: 0;
  min-width: 62px;
}

.calendar-container .cal__navBtn {
  display: inline-flex !important;
}

.cal__navBtn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  background: #1b2e4b;
  color: #e5f2ff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}

.cal__navBtn:hover {
  background: #243b5a;
  border-color: rgba(148, 163, 184, 0.35);
}

.cal__navBtn:disabled {
  opacity: .35;
  cursor: default;
}

.cal__week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
  color: #e5f2ff;
  font-weight: 600;
}

.cal__week span {
  font-size: 11px;
  opacity: 0.7;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* Months grid (12 months) */
.cal__mgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.cal__month {
  height: 32px;
  border-radius: 12px;
  background: rgba(27, 46, 75, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #e5f2ff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
  box-sizing: border-box;
}

.cal__month:hover {
  background: #243b5a;
}

.cal__month:active {
  transform: translateY(1px);
}

.cal__month:focus-visible {
  outline: 2px solid rgba(160, 207, 255, 0.55);
  outline-offset: 2px;
}

.cal__month:disabled {
  opacity: .35;
  cursor: default;
}

.cal__month.is-limited {
  opacity: .45;
}

.cal__month.is-future {
  opacity: .35;
}

.cal__month.is-selected {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.45);
  font-weight: 800;
}



/* Month range paint (months view) */
.cal__month.is-in-range {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.20);
}

.cal__month.is-range-preview {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.16);
}

.cal__month.is-range-start,
.cal__month.is-range-end {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.45);
}

.cal__hint {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(229, 242, 255, 0.65);
}


.cal__day {
  height: 30px;
  border-radius: 10px;
  background: rgba(27, 46, 75, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #e5f2ff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
  box-sizing: border-box;
}

.cal__day:hover {
  background: #243b5a;
}

.cal__day:active {
  transform: translateY(1px);
}

.cal__day:focus-visible {
  outline: 2px solid rgba(160, 207, 255, 0.55);
  outline-offset: 2px;
}

/* Days from prev/next month */
.cal__day.is-other {
  opacity: 0.35;
}

/* Today marker */
.cal__day.is-today {
  border-color: rgba(96, 165, 250, 0.55);
}

/* Disabled days (future / too old) */
.cal__day:disabled {
  opacity: .35;
  cursor: default;
}

/* AccessGate-limited day: clickable but visually disabled */
.cal__day.is-limited {
  opacity: .45;
}

/* Future marker (already disabled in JS) */
.cal__day.is-future {
  opacity: .35;
}

/* Selected endpoints */
.cal__day.is-selected {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.45);
  font-weight: 800;
}

/* Range paint */
.cal__day.is-in-range {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.20);
}

.cal__day.is-range-preview {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.16);
}

.cal__day.is-range-start,
.cal__day.is-range-end {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.45);
}

.cal__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.cal__link {
  background: transparent;
  border: none;
  color: rgba(229, 242, 255, 0.75);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}

.cal__nav .cal__link {
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}

.cal__link:hover {
  background: #243b5a;
  color: #ffffff;
}

.cal__link:disabled {
  opacity: .35;
  cursor: default;
}

/* === Popover (compact) calendar wrapper === */
/* Enable via <div id="calendar" data-calendar-ui="popover"></div> */
.bmcal {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.bmcal__row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.bmcal__field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.bmcal__toggle {
  flex: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #1b2e4b;
  border-radius: 10px;
  padding: 10px 10px;
  height: 36px;
  font-size: 12px;
  color: #e5f2ff;
  outline: none;
}

.bmcal__toggle:hover {
  border-color: rgba(148, 163, 184, 0.35);
}

.bmcal__toggle:focus-visible {
  outline: none;
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.bmcal--open .bmcal__toggle {
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.bmcal__toggleText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bmcal__toggleIcon {
  flex: 0 0 auto;
  opacity: 0.85;
  transition: transform .15s ease;
}

.bmcal--open .bmcal__toggleIcon {
  transform: rotate(180deg);
}

.bmcal__navBtn {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #f6f9ff;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}

.bmcal__navBtn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(148, 163, 184, 0.16);
}

.bmcal__navBtn:disabled {
  opacity: .4;
  cursor: default;
}

.bmcal__popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  transform: none;
  z-index: 100;
}

.bmcal__panel {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  padding: 10px;
  background: #101726;
  border: 1px solid #2b3a57;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.bmcal__panel .cal {
  max-width: 100%;
}

/* Make popover responsive on narrow screens */
@media (max-width: 520px) {
  .bmcal__popover {
    left: 0;
    right: 0;
    transform: none;
    display: flex;
    justify-content: center;
  }

  .bmcal__popover .bmcal__panel {
    min-width: 0;
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }
}
