#marketCalendarBox {
  width: 100%;
  padding: 12px 10px;
  background-color: #fff;
  border-radius: 10px;
  margin-top: 10px;
  box-shadow: -1px 1px 2px 0px rgba(191, 191, 191, 0.71);
  max-width: 600px;
  transition: all 0.3s ease;
}

.market-calendar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header: Month & Arrows */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 18px;
  padding: 0 10px;
  margin-bottom: 10px;
}

.calendar-title {
  color: #2d3748;
}

.calendar-header button {
  background: transparent;
  border: none;
  font-size: 11px;
  color: #073e37;
  cursor: pointer;
  padding: 6px 8px;
}


.calendar-header button:hover {
  border-radius: 50%;
  background: #e2edff;
}

/* Grid */
.calendar-grid {
  padding: 2px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
  font-size: 14px;
  word-break: break-word;
  overflow-x: hidden;
}

.calendar-grid::before {
    content: "";
    position: absolute;
    top: 25px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #e0e0e0a6;
    z-index: 0;
}



/* Weekday headers */
.calendar-day {
  font-size: 11px;
  font-weight: 600;
  color: #6c7179;
  padding: 6px 0;
  /* border-bottom: 1px solid #e2e8f0; */
}

/* Individual date cells */
.calendar-date {
  background: #c9c9c966;
  box-shadow: -1px 1px 2px 0px rgba(191, 191, 191, 0.71);
  border-radius: 5px;
  padding: 5px 3px;
  position: relative;
  font-weight: 500;
  color: #4a5568;
  transition: all 0.2s ease;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.calendar-date:hover {
  transform: translateY(-1px);
  background: #e8e8e8;
  cursor: pointer;
}

/* Today */
.calendar-date.today {
      background: linear-gradient(135deg, #10b981cc, #059668e0) !important;
  font-weight: bold;
  border: 1px solid #4caf50;
}

.calendar-date.today:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #059668e0, #10b981cc)!important;
}


.calendar-date.today .calendar-date-label {
  font-weight: bold;
  color: #fff;
}

.calendar-day-label.today-day {
  color: #059669;
  font-weight: bold;
  position: relative;
  display: inline-block;
}

.calendar-day-label.today-day::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #059669;
  border-radius: 2px;
}

/* Closed market day */
.calendar-date.closed {
  background: #f0f0f0;
  color: #c9c9c9;
  border: 1px dashed #d3d3d3;
}

/* Event = open market day */
.calendar-date.event {
  border: 1px solid #6bc34ac9;
  box-shadow: -1px 1px 2px 0px rgba(191, 191, 191, 0.71);
  background: #ffffff;
  position: relative;
}

.calendar-date.event:hover {
  transform: translateY(-1px);
  background: #dff0d8;
  cursor: pointer;
}

.calendar-date.event::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
  background: #6bc34aa3;
  border-radius: 50%;
}

.calendar-date.short-day {
    border: solid 1px #ffcd6f;
    background-color: #fff6c4;
}


/* Empty cells */
.calendar-date.empty {
  background: transparent;
  border: none;
  box-shadow: none;
}

#calendar-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  white-space: pre-line;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 90%;
}

#calendar-tooltip.visible {
  opacity: 1;
}

/* Tooltip (invisible until hover if needed later) */
.market-hours-tooltip {
  font-size: 10px;
  margin-top: 4px;
  color: #4a5568;
  line-height: 1.3;
  text-align: center;
}


.calendar-legend {
  margin-top: 12px;
  font-size: 13px;
  color: #555;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-item-text {
  font-size: 12px;
  color: #718096;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.today-dot {
  background-color: #059668e0; 
  border: 1px solid #6bc34ac9;
}
  

.event-dot {
  background-color: #ffffff; 
  border: 1px solid #6BC34A;
}

.short-day-dot {
    border: solid 1px #ffcd6f;
    background-color: #fff6c4;
}

.closed-dot {
  background-color: #c9c9c9;
}

/* Сірий закритий день (всі закриті дні окрім сьогодні) */
.calendar-date.closed-day {
  background: #f0f0f0;
  color: #a0aec0;
  border: 1px dashed #d3d3d3;
}

/* Червоний градієнт тільки для сьогодні */
.calendar-date.closed-today-gradient {
  background: linear-gradient(90deg, #f3a2a2, #f24747d8) !important;
  color: white;
  border: 1px solid #f24747;
  font-weight: bold;
}


.calendar-date.closed-day:hover {
  background: linear-gradient(90deg, #ffe1e1, #ffc4c4) !important;
  cursor: pointer;
}

/* =========================
   DARK THEME — Market Calendar
   ========================= */

body.dark #marketCalendarBox{
  background: linear-gradient(180deg, rgba(22,32,45,0.92), rgba(16,24,35,0.92));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    0 18px 45px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
}

/* Header */
body.dark .calendar-title{
  color: rgba(255,255,255,0.90);
}

body.dark .calendar-header{
  color: rgba(255,255,255,0.85);
}

body.dark .calendar-header button{
  color: rgba(230,246,255,0.85);
  border-radius: 10px;
  transition: background 180ms ease, transform 140ms ease, color 180ms ease;
}

body.dark .calendar-header button:hover{
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

/* Divider line under weekdays */
body.dark .calendar-grid::before{
  background: linear-gradient(
    to right,
    transparent,
    rgba(255,255,255,0.10),
    transparent
  );
}

/* Weekday labels */
body.dark .calendar-day{
  color: rgba(255,255,255,0.55);
}

/* Base date cell */
body.dark .calendar-date{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow:
    0 6px 16px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.82);
}

body.dark .calendar-date:hover{
  background: rgba(255,255,255,0.10);
  transform: translateY(-1px);
}

/* Empty */
body.dark .calendar-date.empty{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* TODAY (open) */
body.dark .calendar-date.today{
  background: linear-gradient(135deg, rgba(25,195,125,0.95), rgba(15,143,91,0.95)) !important;
  border: 1px solid rgba(25,195,125,0.55);
  box-shadow:
    0 10px 26px rgba(16,185,129,0.28),
    inset 0 1px 0 rgba(255,255,255,0.18);
}

body.dark .calendar-date.today:hover{
  background: linear-gradient(135deg, rgba(29,211,137,0.95), rgba(15,143,91,0.95)) !important;
}

body.dark .calendar-date.today .calendar-date-label{
  color: #fff;
  font-weight: 700;
}

/* “Today” underline in weekday label */
body.dark .calendar-day-label.today-day{
  color: rgba(25,195,125,0.95);
}
body.dark .calendar-day-label.today-day::after{
  background-color: rgba(25,195,125,0.95);
}

/* EVENT (open day marker) */
body.dark .calendar-date.event{
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(120,255,195,0.28);
}

body.dark .calendar-date.event:hover{
  background: rgba(25,195,125,0.10);
}

body.dark .calendar-date.event::after{
  background: rgba(25,195,125,0.75);
}

/* SHORT DAY */
body.dark .calendar-date.short-day{
  background: rgba(255,205,111,0.12);
  border: 1px solid rgba(255,205,111,0.35);
  color: rgba(255,255,255,0.86);
}

/* CLOSED (non-today) */
body.dark .calendar-date.closed,
body.dark .calendar-date.closed-day{
  background: rgba(255,255,255,0.04);
  border: 1px dashed rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.35);
  box-shadow: none;
}

body.dark .calendar-date.closed-day:hover{
  background: rgba(255,255,255,0.06) !important;
}

/* CLOSED TODAY (red gradient) */
body.dark .calendar-date.closed-today-gradient{
  background: linear-gradient(90deg, rgba(255,115,115,0.35), rgba(242,71,71,0.75)) !important;
  border: 1px solid rgba(242,71,71,0.55);
  color: rgba(255,255,255,0.95);
  box-shadow:
    0 10px 26px rgba(242,71,71,0.18),
    inset 0 1px 0 rgba(255,255,255,0.14);
}

/* Tooltip (як в твоєму стилі) */
body.dark #calendar-tooltip{
  background: rgba(10,14,20,0.92);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
}

/* Market hours text inside cells */
body.dark .market-hours-tooltip{
  color: rgba(255,255,255,0.55);
}

/* Legend */
body.dark .calendar-legend{
  color: rgba(255,255,255,0.70);
}
body.dark .legend-item-text{
  color: rgba(255,255,255,0.55);
}
body.dark .today-dot{
  background-color: rgba(25,195,125,0.95);
  border: 1px solid rgba(25,195,125,0.45);
}
body.dark .event-dot{
  background-color: rgba(255,255,255,0.10);
  border: 1px solid rgba(25,195,125,0.55);
}
body.dark .short-day-dot{
  background-color: rgba(255,205,111,0.18);
  border: 1px solid rgba(255,205,111,0.55);
}
body.dark .closed-dot{
  background-color: rgba(255,255,255,0.22);
}

body.dark #marketCalendarBox > div {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}