/* --- OVERLAY (The dark background) --- */
.cal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cal-overlay.open {
  display: block;
  opacity: 1;
}

/* --- MODAL (The Calendar Container) --- */
#meeting-div {
  /* THEME VARIABLES */
  --cal-primary-color: #0069ff;
  --cal-highlight-color: #e6f0ff;
  --cal-bg-color: #ffffff;

  /* POSITIONING */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 9999;

  /* STYLING */
  background: var(--cal-bg-color);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  max-width: 800px;
  width: 90%;

  display: none;
  overflow: hidden;
  font-family: sans-serif;
  opacity: 0;
  transition: all 0.3s ease;
}

#meeting-div.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* --- LEFT SIDEBAR --- */
#meeting-div .cal-sidebar {
  width: 35%;
  padding: 20px;
  border-right: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f9fafb;
}

#meeting-div .cal-sidebar h2 {
  margin-top: 20px;
  font-size: 1.2rem;
  text-align: center;
}

#meeting-div .cal-sidebar p {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

#meeting-div .cal-logo {
  width: 100%;
  min-height: 20px;
  display: flex;
  justify-content: center;
}

#meeting-div .cal-logo-img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}

/* --- RIGHT MAIN CONTENT --- */
#meeting-div .cal-main {
  width: 65%;
  padding: 20px;
  position: relative; /* For transitions if needed */
}

/* Header with Back Button */
#meeting-div .cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-weight: bold;
  height: 30px;
}

#meeting-div .cal-back-btn {
  background: none;
  border: none;
  color: var(--cal-primary-color);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}

#meeting-div .cal-back-btn:hover {
  text-decoration: underline;
}

/* Calendar Grid */
#meeting-div .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

#meeting-div .cal-day-header {
  text-align: center;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 5px;
}

#meeting-div .cal-day {
  padding: 10px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
}

#meeting-div .cal-day:hover:not(.empty) {
  background-color: var(--cal-highlight-color);
  color: var(--cal-primary-color);
}

/* TIME SLOTS VIEW */
#meeting-div .cal-view-time {
  /* This display is toggled via JS, but we define grid properties here */
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 300px;
  overflow-y: auto; /* Scroll if too many times */
  padding-right: 5px;
}

#meeting-div .time-btn {
  padding: 12px;
  border: 1px solid var(--cal-primary-color);
  color: var(--cal-primary-color);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

#meeting-div .time-btn:hover {
  background: var(--cal-primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* GLOBAL CLOSE BTN */
.cal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #ccc;
  z-index: 100;
}
.cal-close-btn:hover {
  color: #333;
}

/* --- FORM ELEMENTS (Sidebar) --- */
#meeting-div .cal-input-group {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#meeting-div .cal-email-input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box; /* Fixes padding overflow */
}

#meeting-div .cal-submit-btn {
  padding: 10px;
  background-color: var(--cal-primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  opacity: 1;
  transition: opacity 0.3s;
}

#meeting-div .cal-submit-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.7;
}

/* --- DISABLED STATES --- */
#meeting-div .cal-day.disabled {
  color: #ccc;
  cursor: not-allowed;
  background: none;
}
#meeting-div .cal-day.disabled:hover {
  background: none;
  color: #ccc;
}

#meeting-div .time-btn.disabled {
  display: none;
}
#meeting-div .time-btn.disabled:hover {
  background: #f9f9f9;
  color: #ccc;
  box-shadow: none;
  transform: none;
}

/* Selected Time Slot Styling */
#meeting-div .time-btn.selected {
  background: var(--cal-primary-color);
  color: white;
}

.cal-selected-info {
  margin-top: 20px;
  padding: 15px;
  background-color: #fff;
  border: 1px solid #eee;
  border-left: 4px solid var(--cal-primary-color);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  font-weight: bold;
  color: var(--cal-primary-color);
  text-align: left;
  line-height: 1.4;
}
