:root {
  --dark-text: #107549;
  --light-body: #f3f8fe;
  --light-main: #fdfdfd;
  --light-second: #c3c2c8;
  --light-hover: #edf4f0; /* FIXED: Defined missing color values */
  --light-text: #151426;
  --light-btn: rgb(228, 236, 222);
  --blue: #0000ff;
  --white: #fff;
  --shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
  --font-family: consolas;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.calendar {
  font-family: Microsoft JhengHei UI;
  width: 100%;
  background-color: rgba(225, 233, 226, 0.205);
  border-radius: 25px;
  padding: 25px 15px 45px 15px;
  box-shadow: var(--shadow);
}

.calendar {
  overflow: visible !important; /* Allows the detailed info container to expand freely */
  height: auto !important;     /* Removes any implicit height limits */
}

.calendar-header {
  background: #a7cd54;
  border-radius: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--white);
  padding: 10px;
}

.calendar-body {
  padding: 10px; /* FIXED: Corrected spelling from 'pad' to 'padding' */
}

.calendar-week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-weight: 600;
  cursor: pointer;
  color: rgb(7, 6, 6);
}

.calendar-week-days div:hover {
  color: rgb(10, 2, 254);
  transform: scale(1.1); /* FIXED: Reduced from 1.2 to keep alignment safe */
  transition: all .2s ease-in-out;
}

.calendar-week-days div {
  display: grid;
  place-items: center;
  color: var(--light-second); /* FIXED: Replaced undefined --bg-second variable */
  height: 50px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px; /* FIXED: Slight increase to allow safe cell flex spaces */
  padding: 10px;
}

/* FIXED: Unified the dual conflicting child selector blocks into one standard design rule */
.calendar-day-cell {
  background-color: #ffffff;
  background-size: cover;        /* Force background images to crop perfectly into the square */
  background-position: center;   /* Keep the host's face centered inside the block matrix */
  background-repeat: no-repeat;
  
  border: 1px solid rgba(16, 117, 73, 0.15);
  border-radius: 14px;
  min-height: 115px; 
  height: auto !important; 
  padding: 8px 8px 10px 8px; 
  
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.cell-top-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.host-avatar-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Pushes profile text tightly to the right corner */
  text-align: right;
  max-width: 70%;
}

.host-cell-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--dark-text);
  box-shadow: rgba(0, 0, 0, 0.08) 0px 2px 4px;
  margin-bottom: 2px;
}

/* --- Tiny Crisp Host Name Tag Style --- */
.host-cell-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.day-number {
  font-size: 1.25rem; /* Increased from 0.95rem to make the date stand out boldly */
  font-weight: 800;   /* Extra bold look */
  color: #1a1a1a;     /* Sharper contrast */
  margin-bottom: 6px;
}

.day-event-label {
  display: block;
  width: 100%;
  box-sizing: border-box;
  white-space: normal; 
  overflow: hidden;
  
  /* Upgraded Size and Spatial Density Rules */
  font-size: 0.72rem;   /* Increased from 0.65rem for high legibility */
  line-height: 1.2;    /* Bold font weight to fill up visual space */
  padding: 5px 4px;    /* Increased padding to make the green cell block look solid and thick */
  background-color: #012315; 
  color: white;
  border-radius: 6px;  /* Slightly rounder edges to match the larger look */
  text-align: center;
  margin-top: auto;    
  box-shadow: rgba(16, 117, 73, 0.15) 0px 3px 6px; /* Adds depth to the block */
}

/* --- Color Coded Session Badges --- */

/* 1. Weight Loss Program Track - Light Blue Tint */
.day-event-label.track-wlp {
  background-color: #2980b9 !important;
  box-shadow: rgba(41, 128, 185, 0.2) 0px 3px 6px;
}

/* 2. Funday Track - Vibrant Yellow Accent */
.day-event-label.track-funday {
  background-color: #f1c40f !important;
  color: #2c3e50 !important; /* Darker text for excellent high-contrast legibility */
  box-shadow: rgba(241, 196, 15, 0.2) 0px 3px 6px;
}

/* 3. Fuel Magic Track - Energetic Orange */
.day-event-label.track-fuelmagic {
  background-color: #e67e22 !important;
  box-shadow: rgba(230, 126, 34, 0.2) 0px 3px 6px;
}

/* 4. Recognition Tracks - Royal Purple Tint */
.day-event-label.track-recognition {
  background-color: #8e44ad !important;
  box-shadow: rgba(142, 68, 173, 0.2) 0px 3px 6px;
}

/* 5. LSD Tracks - Sleek Charcoal Grey */
.day-event-label.track-lsd {
  background-color: #34495e !important;
  box-shadow: rgba(52, 73, 94, 0.2) 0px 3px 6px;
}

/* 6. Family Day Tracks - Rose Pink Red Accent */
.day-event-label.track-family {
  background-color: #e74c3c !important;
  box-shadow: rgba(231, 76, 60, 0.2) 0px 3px 6px;
}

/* 7. Default Health & Wellness Topics Fallback - Clean Dark Green Theme */
.day-event-label.track-standard {
  background-color: #107549 !important;
  box-shadow: rgba(16, 117, 73, 0.15) 0px 3px 6px;
}


/* --- Smooth Interaction Update --- */
.calendar-day-cell:hover {
  border-color: #261075;
  transform: translateY(-3px); 
  box-shadow: rgba(16, 117, 73, 0.25) 0px 8px 24px;
  z-index: 5;
}

.calendar-day-cell.current-date {
  color: var(--dark-text);
  border: 2px solid rgb(2, 18, 251);
  font-weight: 800;
  background-color: rgba(255, 255, 255, 0.95);
}

.month-picker {
  padding: 5px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.month-picker:hover {
  background-color: var(--light-hover);
  color: var(--dark-text);
}

.year-picker {
  display: flex;
  align-items: center;
}

.year-change {
  height: 30px;
  width: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0px 10px;
  cursor: pointer;
}

.year-change:hover {
  background-color: var(--light-btn);
  transition: all .2s ease-in-out;
  transform: scale(1.12);
}

.calendar-footer {
  display: block !important;    /* Disables the old flex centering rule that squishes the cards */
  width: 100% !important;
  padding: 30px 15px 15px 15px !important; /* Adds safe inner padding so text doesn't touch the bottom curve */
  box-sizing: border-box !important;
  border-radius: 5px;
}

.myevents-info ul {
  margin: 0;
  padding: 0;
}

.myevents-info li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  color: #333;
}

#year:hover {
  cursor: pointer;
  transform: scale(1.1);
  transition: all 0.2s ease-in-out;
}

.month-list {
  position: relative;
  left: 0;
  top: -50px;
  background-color: #ebebeb;
  color: var(--light-text);
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 5px;
  border-radius: 20px;
}

.month-list > div {
  display: grid;
  place-content: center;
  margin: 5px 10px;
  transition: all 0.2s ease-in-out;
}

.month-list > div > div {
  border-radius: 15px;
  padding: 10px;
  cursor: pointer;
}

.month-list > div > div:hover {
  background-color: var(--light-btn);
  color: var(--dark-text);
  transform: scale(0.9);
  transition: all 0.2s ease-in-out;
}

.month-list.show {
  visibility: visible;
  pointer-events: visible;
  transition: 0.6s ease-in-out;
  animation: to-left .71s forwards;
}

.month-list.hideonce {
  visibility: hidden;
}

.month-list.hide {
  animation: to-right 1s forwards;
  visibility: none;
  pointer-events: none;
}


/* Event Loader Widget Configuration */
.loader {
  border: 12px solid rgb(36, 43, 225);
  border-top: 12px solid gainsboro;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  animation: spin 1.2s linear infinite;
  position: absolute;
  z-index: 10;
  top: 45%;
  left: 45%;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.hide-loader {
  display: none;
}

/* ==========================================================================
   FLUID STRETCH & CONTAINER-FIT MOBILE CALENDAR REPAIR
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Force all wrapping divs to fit exactly 100% width of the parent layout */
  #event, 
  #event .container, 
  #event .row, 
  #event [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  /* 2. Lock calendar container to full available div width */
  .calendar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 10px 4px 15px 4px !important;
    margin: 0 auto !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }

  .calendar-body {
    padding: 0 !important;
    width: 100% !important;
  }

  /* 3. Lock all 7 columns into strict proportional widths */
  .calendar-days, 
  .calendar-week-days {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 3px !important; /* Small gap gives columns maximum horizontal breathing room */
    padding: 2px 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 4. ALLOW CELLS TO STRETCH HEIGHT NATURALLY */
  .calendar-day-cell {
    min-height: 85px !important; /* Base minimum size */
    height: auto !important;     /* STRETCHES dynamically vertically if text wraps */
    padding: 6px 3px !important;
    border-radius: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }

  /* 5. Compact Date & Avatar Row Alignment */
  .cell-top-row {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 4px !important;
  }

  .day-number {
    font-size: 0.85rem !important; 
    font-weight: 800 !important;
    line-height: 1 !important;
    margin-bottom: 0 !important;
  }

  .host-avatar-box {
    max-width: 50% !important;
  }

  .host-cell-img {
    width: 16px !important;
    height: 16px !important;
    border-width: 1px !important;
    margin-bottom: 0 !important;
  }

  /* Hide the text host names to save horizontal room inside small cells */
  .host-cell-name {
    display: none !important; 
  }

  /* 6. ALLOW EVENT NAMES TO WRAP INTO MULTIPLE LINES */
  .day-event-label {
    font-size: 0.55rem !important; /* Crisp small mobile font */
    line-height: 1.1 !important;
    padding: 2px 1px !important;
    border-radius: 3px !important;
    
    white-space: normal !important;  /* ALLOWS TEXT TO WRAP INTO TWO OR THREE ROWS */
    word-break: break-word !important; /* Breaks extra long words safely if needed */
    overflow: visible !important;
    text-overflow: clip !important;
    
    width: 100% !important;
    display: block !important;
    margin-top: auto !important;
  }

  /* 7. Weekday Sizing Header Banner (Sun - Sat) */
  .calendar-week-days div {
    font-size: 0.75rem !important;
    height: 25px !important;
    line-height: 25px !important;
  }
}
