/* Calendar Main */
#calendar {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    padding: 40px;
    width: 45%;
    max-width: 100%;
    overflow-x: hidden;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

#calendar-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    cursor: pointer;

    /* Button-like appearance */
    padding: 10px 16px;
    border: 2px solid #2196F3;
    border-radius: 8px;
    background-color: #f5faff;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    gap: 10px;
}

#calendar-title:hover {
    background-color: #e3f2fd;
    border-color: #1976D2;
}

/* Hidden by default */
#calendar-menu-icon {
  font-size: 24px;
  cursor: pointer;
  color: #333;
  transition: color 0.3s ease;
  flex-shrink: 0;
  margin-left: auto;
  display: inline !important; /* Visible by default */
}

.hide-icon #calendar-menu-icon {
  display: none !important; /* Hide when .hide-icon is on a parent */
}

/* When we want to show it */
#calendar-menu-icon.is-visible {
  display: inline-flex !important; /* This wins when toggled from JS */
}

#calendar-menu-icon:hover {
    color: #ff9800;
}

#calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Keep initial hidden state */
#calendar-header,
.date-grid {
    display: none; /* Initially hidden */
}

#month-year {
    font-size: 20px;
    font-weight: bold;
}

#prev-month,
#next-month {
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #333;
}

#prev-month:hover,
#next-month:hover {
    color: #ff9800;
}

.date-grid {
    /* Layout is ready even when hidden */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.date-grid div {
    padding: 15px;
    text-align: center;
    background: #b4d7f3;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease;
    min-width: 0; /* Prevent overflow on mobile */
    box-sizing: border-box;
    position: relative;          /* for cross pseudo-element */
    background-origin: padding-box;
    background-clip: padding-box;
}

.date-grid div:hover {
    background: #ff9800;
}

.date-grid.stretch-mode {
    max-height: 600px;
    overflow-y: scroll;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Today variants (no default orange) -------------------------------- */
.today {} /* marker only */

/* Today when NOT selected: use normal day colors; keep cross */
.today-unselected {} 

/* Today when selected: color comes from .black-day/.blue-days etc.; hide cross via rule below */
.today-selected {}

/* Light blue days */
.blue-days {
    background-color: #2196F3 !important;
    color: white;
}
.blue-days:hover { background-color: #1976D2 !important; }

/* Optional singular alias */
.blue-day { background-color: #2196F3; color: white; }
.blue-day:hover { background-color: #1976D2; }

/* Selected (dark) */
.black-day {
    background-color: #000 !important;
    color: white;
}
.black-day:hover { background-color: #333 !important; }

/* Day view highlight */
.date-grid div.orange-day {
    background-color: orange !important;
    color: white !important;
    border-radius: 50%;
}
.date-grid div.orange-day:hover { background-color: darkorange !important; }

/* --- Cross for UNSELECTED days ----------------------------------------- */
/* JS should add 'unselected-day' to cells that are NOT selected */
.unselected-day::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 48%;
    height: 48%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: .45;

    /* draw two thin diagonal lines */
    background-image:
      linear-gradient(45deg,
        transparent calc(50% - 1.5px),
        rgba(255,255,255,.9) calc(50% - 1.5px),
        rgba(255,255,255,.9) calc(50% + 1.5px),
        transparent calc(50% + 1.5px)),
      linear-gradient(-45deg,
        transparent calc(50% - 1.5px),
        rgba(255,255,255,.9) calc(50% - 1.5px),
        rgba(255,255,255,.9) calc(50% + 1.5px),
        transparent calc(50% + 1.5px));
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}

/* never show the cross on selected/highlight cells */
.black-day::after,
.orange-day::after,
.today-selected::after { content: none; }

/* (Optional) if you use 'green-days' outside selection mode */
.green-days {
    background-color: #9fd0ff !important; /* slightly lighter than default */
    color: white;
}
.green-days:hover { background-color: #86c4ff !important; }

/* Itinerary lists */
#second-itinerary li {
    cursor: pointer;
    transition: background 0.3s ease-in-out;
}
#second-itinerary li:hover { background: rgba(100, 200, 255, 0.3); }
#second-itinerary li.selected {
    background: rgba(50, 150, 255, 0.5);
    font-weight: bold;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    #calendar {
        width: 100% !important;
        padding: 20px !important;
        margin-bottom: 20px;
        order: -1;
        opacity: 1 !important;
        display: block !important;
    }

    #calendar-title {
        font-size: 20px;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    #calendar-header {
        position: relative;
        height: 40px;
        margin-bottom: 20px;
    }

    #month-year {
        font-size: 18px;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        text-align: center;
        white-space: nowrap;
    }

    #prev-month,
    #next-month {
        position: absolute;
        top: 0;
        font-size: 20px;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    #prev-month { left: 0; }
    #next-month { right: 0; }

    .date-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .date-grid div {
        padding: 12px;
        font-size: 14px;
    }
}

