:root {
  --bg-main: #f4f7f6;
  --bg-panel: white;
  --bg-header: #0056b3;
  --bg-hover: #eef4f9;
  --bg-overlay: rgba(0, 0, 0, 0.58);
  --bg-modal: #f0f2f5;
  
  --text-main: #333;
  --text-header: white;
  --text-muted: #666;
  --text-light: #999;
  --text-secondary: #555;
  --text-dark: #444;
  --text-black: #222;
  
  --brand-primary: #0056b3;
  --brand-hover: #004494;
  
  --border-light: #eee;
  --border-med: #ccc;
  --border-dark: #ddd;
  
  --danger: #dc3545;
  --danger-hover: #b92d3a;
  --success: #28a745;
  
  --badge-bg: #e0f2fe;
  --badge-text: #0284c7;
  
  --shadow-color: rgba(0,0,0,0.1);
  --shadow-strong: rgba(0,0,0,0.2);
}

body.dark-mode {
  --bg-main: #121212;
  --bg-panel: #1e1e1e;
  --bg-header: #1a1a1a;
  --bg-hover: #2a2a2a;
  --bg-overlay: rgba(0, 0, 0, 0.75);
  --bg-modal: #252525;
  
  --text-main: #e0e0e0;
  --text-header: #e0e0e0;
  --text-muted: #a0a0a0;
  --text-light: #777;
  --text-secondary: #b0b0b0;
  --text-dark: #ccc;
  --text-black: #eee;
  
  --brand-primary: #4dabf7;
  --brand-hover: #3b8fd9;
  
  --border-light: #333;
  --border-med: #444;
  --border-dark: #444;
  
  --danger: #f87171;
  --danger-hover: #ef4444;
  --success: #4ade80;
  
  --badge-bg: #1e3a8a;
  --badge-text: #60a5fa;
  
  --shadow-color: rgba(0,0,0,0.5);
  --shadow-strong: rgba(0,0,0,0.7);
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: clamp(10px, 2vw, 20px);
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.3s, color 0.3s;
}

.master-header {
  display: contents;
}

.top-sticky-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-header);
  color: var(--text-header);
  margin-top: calc(-1 * clamp(10px, 2vw, 20px));
  margin-left: calc(-1 * clamp(10px, 2vw, 20px));
  margin-right: calc(-1 * clamp(10px, 2vw, 20px));
  padding: calc(env(safe-area-inset-top) + 4px) clamp(10px, 2vw, 20px) 5px;
  display: flex;
  align-items: center;
  transition: background-color 0.3s;
  box-shadow: 0 4px 6px var(--shadow-color);
}

.header-brand { 
  display: flex; 
  align-items: center; 
  gap: 15px; 
  flex: 1 1 auto;
}

.header-logo {
  height: clamp(45px, 6vw, 65px);
  width: clamp(45px, 6vw, 65px);
  border-radius: 8px; 
  object-fit: cover; 
  flex-shrink: 0; 
}

.header-brand h1 { 
  margin: 0; 
  font-size: clamp(1.5rem, 4vw, 1.8rem);
  letter-spacing: 1px; 
  line-height: 1.1; 
}

.main-header-controls {
  background-color: var(--bg-header);
  color: var(--text-header);
  padding: 10px clamp(10px, 2vw, 20px) 15px; 
  border-radius: 0px;
  margin-top: 0px;
  margin-left: calc(-1 * clamp(10px, 2vw, 20px));
  margin-right: calc(-1 * clamp(10px, 2vw, 20px));
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  box-shadow: 0 4px 6px var(--shadow-color);
  transition: background-color 0.3s;
}

/* ========================================================
   DESKTOP OVERRIDE: Unifies header for Tablets & Browsers 
   ======================================================== */
@media (min-width: 769px) {
  .master-header {
    background-color: var(--bg-header);
    color: var(--text-header);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px var(--shadow-color);
  }
  
  /* Flattens the layout so children behave exactly like they did before */
  .top-sticky-banner, .main-header-controls {
    display: contents;
  }
  
  .header-logo {
    height: clamp(60px, 8vw, 80px);
    width: clamp(60px, 8vw, 80px);
  }
  
  /* Restores the original max-width so it doesn't push other things off-screen */
  .header-brand {
    flex: 1 1 auto;
    min-width: 250px;
    max-width: 420px;
  }
  
  /* Caps width and uses margin-left: auto to right-justify it against the gap */
  .header-search {
    flex: 1 1 200px !important;
    width: auto !important;
    max-width: 350px !important;
    margin-left: auto !important; 
  }
  
  /* Resets the controls margin so they wrap naturally below if space is tight */
  .header-controls {
    margin-left: 0;
  }
}


.header-logo {
  height: clamp(60px, 8vw, 80px);
  width: clamp(60px, 8vw, 80px);
  border-radius: 8px; 
  box-shadow: 0 0px 0px var(--shadow-strong);
  object-fit: cover; 
  flex-shrink: 0; 
}

.header-brand h1 { 
  margin: 0; 
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  letter-spacing: 1px; 
  line-height: 1.1; 
}

.header-controls { 
  display: flex; 
  gap: 15px; 
  align-items: center;
}

.header-btn {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.2s;
}
.header-btn:hover { background-color: rgba(255, 255, 255, 0.3); }

.header-settings-btn {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.1s;
}
.header-settings-btn:hover { opacity: 1; transform: scale(1.05); }
.header-settings-btn svg { width: 24px; height: 24px; }
.header-settings-btn span { font-size: 11px; font-weight: bold; letter-spacing: 0.5px; }

.header-search {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 0px 15px;
  box-shadow: inset 0 1px 3px var(--shadow-color);
  flex: 1 1 auto;
  width: 100%;
  max-width: 450px;
  height: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box;
}
.header-search input {
  border: none !important;
  outline: none !important;
  font-size: clamp(1rem, 4vw, 1.2rem) !important;
  line-height: 1.2 !important; 
  height: 100% !important; 
  padding: 0px 10px !important; 
  margin: 0 !important;
  flex-grow: 1;
  background: transparent !important;
  color: var(--text-main);
  width: 100%;
}
.header-search button {
  background: none !important;
  border: none !important;
  cursor: pointer;
  font-size: 26px !important;
  color: var(--brand-primary);
  padding: 0px 5px !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100% !important;
}



.search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
  background: var(--bg-hover);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}
.search-controls label { font-size: 18px; font-weight: bold; color: var(--text-dark); }
.search-controls input { width: 90px; padding: 10px; font-size: 18px; border-radius: 6px; border: 1px solid var(--border-med); background: var(--bg-panel); color: var(--text-main); }

.dashboard-container {
  display: flex;
  gap: clamp(10px, 2vw, 20px);
  height: calc(100vh - 125px); 
  min-height: 600px;
}

.left-panel {
  flex: 1;
  background: var(--bg-panel);
  border-radius: 8px;
  padding: clamp(10px, 2vw, 20px);
  box-shadow: 0 2px 4px var(--shadow-color);
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s;
}
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vw, 20px);
}
.messages-panel, .future-panel {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: clamp(10px, 2vw, 20px);
  box-shadow: 0 2px 4px var(--shadow-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background-color 0.3s;
  min-height: 250px;
}

/* Force the messages panel to resist shrinking, pushing the height reduction onto the future panel */
.messages-panel {
  flex: 1.2; 
}
.future-panel {
  flex: 0.8; 
}


@media (max-width: 1024px) {
  .dashboard-container {
    flex-direction: column;
    height: auto;
  }
  .scroll-box {
    overflow-y: visible;
  }
}

@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    align-items: stretch;
  }
  .header-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    width: 100%;
  }
  .header-btn {
    padding: 8px 4px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-size: clamp(12px, 3.5vw, 14px);
  }
  
  /* Target the exact grid positions safely via ID */
  #btn-search { order: 1; }
  #btn-switch { order: 2; }
  #btn-help { order: 3; justify-self: center; align-self: center; }
  
  #btn-add { order: 4; }
  #btn-msg { order: 5; }
  #btn-customize { order: 6; justify-self: center; align-self: center; }

  .header-search {
    max-width: 100%;
  }
  #fullscreen-btn {
    display: none;
  }

  /* Hide the View button column on mobile */
  .future-table .col-edit {
    display: none;
  }
  
  /* Scale text dynamically and tighten padding for small screens */
  .future-table td {
    font-size: clamp(14px, 4.5vw, 20px);
    padding: 8px 2px;
  }

/* Redistribute the space to the remaining columns */
  .future-table .col-date { width: 40%; padding-right: 10px; }
  .future-table .col-title { width: 37%; }
  .future-table .col-days { 
    width: 23%; 
    font-size: clamp(11px, 3.2vw, 14px); 
  }
  
  /* Make the row look clickable on touch */
  .future-table .clickable-row {

    cursor: pointer;
  }
  .future-table .clickable-row:active {
    background-color: var(--bg-hover);
  }
}


.date-banner {
  color: red;
  font-weight: 600; /* Semi-bold */
  font-size: 32px;
  margin-bottom: 12px;
}

h2 {
  margin-top: 0;
  color: var(--brand-primary);
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 10px;
  margin-bottom: 10px;
  font-size: 22px;
}
.current-date-subheader {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: bold;
  margin-bottom: 15px;
}

.edit-btn {
  background: none;
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.edit-btn:hover { background: var(--bg-hover); }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--brand-primary);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.1s;
}
.icon-btn:hover { opacity: 1; transform: scale(1.1); }

.day-group-header {
  background-color: var(--bg-hover);
  color: var(--brand-primary);
  padding: 8px 12px;
  font-weight: bold;
  border-radius: 4px;
  margin-top: 15px;
  margin-bottom: 10px;
  font-size: 22px;
}
.event-line-item {
  padding: 6px 12px;
  border-left: 3px solid var(--border-med);
  margin-left: 5px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.event-details { display: flex; flex-direction: column; gap: 2px; }
.event-time { font-size: 18px; color: var(--text-muted); }
.event-title { font-weight: bold; color: var(--text-main); font-size: 22px; }
.event-location, .event-notes { font-size: 18px; color: var(--text-secondary); margin-top: 4px; padding-left: 2px; }
.event-location { font-style: italic; }

.message-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 18px;
}
.message-item strong { color: var(--brand-primary); }

.future-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  table-layout: fixed;
}
.future-table td {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-light);
  font-size: 20px;
  vertical-align: middle;
}
.col-date { width: 16%; font-weight: bold; color: var(--text-dark); white-space: nowrap; }
.col-edit { width: 16%; text-align: center; }
.col-title { width: 44%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-main); padding-left: 4px; }
.col-days { width: 24%; color: var(--text-muted); text-align: right; white-space: nowrap; font-size: 15px; }

.view-btn {
  background: var(--badge-bg);
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  border-radius: 4px;
  padding: 2px 2px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  background: var(--brand-primary);
  color: white;
}


.carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 10px;
}
.carousel-title-wrapper { display: flex; align-items: baseline; gap: 8px; }
.carousel-header h2 { border: none; margin: 0; padding: 0; }
#carousel-timer { color: var(--text-muted); font-size: 14px; font-weight: normal; }
.nav-arrow {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--brand-primary);
  cursor: pointer;
}

.scroll-box { flex: 1; overflow-y: auto; overflow-x: hidden; }
.carousel-section { display: none; }
.carousel-section.active { display: block; }

.icon-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 15px;
  margin-top: 10px;
}
.icon-option {
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 8px;
  padding: 5px;
  transition: border-color 0.2s, transform 0.2s, background-color 0.2s;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-option img {
  width: 100%;
  height: auto;
  max-height: 60px;
  object-fit: contain;
  border-radius: 4px;
}
.icon-option input[type="radio"] { display: none; }
.icon-option:has(input[type="radio"]:checked) {
  border-color: var(--brand-primary);
  background-color: var(--bg-hover);
  transform: scale(1.08);
  box-shadow: 0 4px 8px var(--shadow-color);
}

#sleep-overlay {
  position: fixed;
  inset: 0;
  background-color: black;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}
#sleep-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}
.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.theme-switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-med);
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--brand-primary); }
input:checked + .slider:before { transform: translateX(22px); }

.overlay-backdrop {
  position: fixed;  
  inset: 0;
  background: var(--bg-overlay);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2vw, 20px);
  box-sizing: border-box;
}
.overlay-backdrop.visible { display: flex; }

.overlay-panel {
  background: var(--bg-modal);
  width: 100%;
  max-width: 680px;
  max-height: 85dvh;
  overflow-y: auto;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  padding: clamp(15px, 4vw, 20px);
  box-sizing: border-box;
  transition: background-color 0.3s;
}
.form-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 15px;
}
.app-header { color: var(--brand-primary); }
.app-header h1 { margin: 0; font-size: 2em; letter-spacing: 1px; }
.app-header p { margin: 5px 0 0 0; font-weight: bold; color: var(--text-muted); }

.close-form-btn {
  background-color: var(--danger);
  color: white;
  border: none;
  padding: 12px 18px;
  font-size: 1em;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.close-form-btn:hover { background-color: var(--danger-hover); }

.form-container {
  background: var(--bg-panel);
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color);
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.3s;
}

.form-group { margin-bottom: 15px; }
.form-container label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  color: var(--text-dark);
  font-size: 1.2em;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 0;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0; 
    flex: 1; 
    font-size: 1.15em;
    line-height: 1.3;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin: 0; 
    width: 28px;
    height: 28px;
    cursor: pointer;
    accent-color: var(--brand-primary);
}


input[type="text"], input[type="number"], select, textarea, input[type="datetime-local"], input[type="date"], input[type="time"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-med);
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 1.2em; 
  font-family: inherit;
  background-color: var(--bg-panel);
  color: var(--text-main);
}

.hidden-file-input { display: none !important; }
.custom-file-upload {
  display: block;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid var(--brand-primary);
  background-color: var(--badge-bg);
  color: var(--brand-primary);
  font-weight: bold;
  font-size: 1.1em;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.2s;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 5px;
}
.custom-file-upload:hover { background-color: var(--bg-hover); }

.file-name-display {
  font-size: 0.95em;
  color: var(--text-muted);
  margin-bottom: 12px;
  word-wrap: break-word;
  display: block;
  text-align: center;
}

textarea { resize: vertical; min-height: 100px; }
.submit-message-btn {
  background-color: var(--brand-primary);
  color: white;
  border: none;
  padding: 14px 20px;
  font-size: 1.1em;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
  transition: background-color 0.2s;
}
.submit-message-btn:hover { background-color: var(--brand-hover); }
.submit-message-btn:disabled { background-color: var(--text-light); cursor: not-allowed; }

.status-message { text-align: center; margin-top: 15px; font-weight: bold; min-height: 20px; }
.success { color: var(--success); }
.error { color: var(--danger); }
.help-text { font-size: 1.05em; color: var(--text-muted); margin-top: 3px; }
.duration-container { display: flex; gap: 10px; }

.message-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-dark);
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 6px;
  box-shadow: 0 1px 3px var(--shadow-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  transition: background-color 0.3s;
}
.message-content-left { flex-grow: 1; }
.message-sender { font-weight: bold; color: var(--brand-primary); margin-bottom: 5px; font-size: 1.1em; }
.recipient-badge {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  margin-left: 8px;
}
.message-timestamp { font-weight: normal; color: var(--text-muted); font-size: 0.85em; }
.message-text { font-size: 1.3em; line-height: 1.4; white-space: pre-wrap; color: var(--text-black); }

.reaction-container { display: flex; gap: 12px; flex-shrink: 0; }
.reaction-btn {
  background: none;
  border: none;
  font-size: 1.8em;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s, transform 0.2s;
  padding: 0;
}
.reaction-btn:hover { opacity: 0.7; transform: scale(1.1); }
.reaction-btn.active { opacity: 1 !important; transform: scale(1.2); }
.reaction-btn.hidden { display: none; }

.header-brand h1, .header-logo { transition: opacity 0.3s ease-in-out; }
.loading .header-brand h1, .loading .header-logo { opacity: 0; }

#help-content-container {
  color: var(--text-main);
  line-height: 1.6;
  padding: 0 10px;
}
#help-content-container h1, #help-content-container h2, #help-content-container h3 {
  color: var(--brand-primary);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: bold;
}
#help-content-container h1 { 
  font-size: 2.2em; 
  border-bottom: 2px solid var(--border-light); 
  padding-bottom: 10px; 
}
#help-content-container h2 { 
  font-size: 1.6em; 
  margin-top: 2em;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 5px;
}
#help-content-container h3 { font-size: 1.3em; }
#help-content-container p { margin-bottom: 1.2em; }
#help-content-container ul, #help-content-container ol {
  margin-bottom: 1.5em;
  padding-left: 30px;
}
#help-content-container ul { list-style-type: disc; }
#help-content-container ol { list-style-type: decimal; }
#help-content-container li { margin-bottom: 0.5em; }
#help-content-container li p { margin-bottom: 0; }
#help-content-container strong { font-weight: 700; color: var(--text-main); }
#help-content-container em { font-style: italic; }
#help-content-container hr {
  border: none;
  border-top: 2px dashed var(--border-med);
  margin: 2.5em 0;
}
/* Modular Settings Menu Styles */
.settings-menu-container {
  padding: 10px 5px;
}

.settings-section {
  background-color: var(--bg-panel);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color);
  margin-bottom: 25px;
}

.settings-section-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 25px;
}

.settings-nav-link {
  display: flex;
  align-items: center;
  gap: 15px;
  background-color: var(--bg-panel);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color);
  text-decoration: none;
  color: var(--text-main);
  transition: transform 0.2s, box-shadow 0.2s;
}

.settings-nav-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px var(--shadow-strong);
}

.nav-link-icon {
  font-size: 1.8em;
}

.nav-link-text {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.nav-link-text strong {
  font-size: 1.1em;
  color: var(--text-dark);
}

.nav-link-text small {
  font-size: 0.9em;
  color: var(--text-muted);
}

.nav-link-arrow {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--text-light);
}

/* Dual Entry-Point Tabs */
.entry-point-tabs {
    display: flex;
    background: var(--bg-hover);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 20px;
    gap: 5px;
}
.entry-tab {
    flex: 1;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}
.entry-tab.active {
    background: var(--brand-primary);
    color: white;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Plain Language Frequency Pills */
.pill-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.freq-pill {
    flex: 1;
    min-width: 100px;
    padding: 12px;
    border: 2px solid var(--border-med);
    border-radius: 8px;
    background: var(--bg-panel);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}
.freq-pill.active {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: white;
}

/* Day of Week Selector (S M T W T F S) */
.day-selector {
    border: none;
    padding: 0;
    margin: 20px 0;
}
.day-selector legend {
    font-weight: bold;
    margin-bottom: 10px;
}
.day-pills {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}
.day-pill {
    position: relative;
    cursor: pointer;
    flex: 1;
    aspect-ratio: 1 / 1;
    max-width: 50px;
}
.day-pill input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}
.day-pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--border-light);
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-main);
    transition: all 0.2s;
}
.day-pill input:checked ~ span {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: white;
}

/* Time Row Layout */
.time-row {
    display: flex;
    flex-direction: column; 
    gap: 16px; 
}
.time-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; 
}

/* Target ALL date inputs in the calendar form to shrink them uniformly */

#calendarForm input[type="date"] {
    padding: 8px 8px;
    font-size: 0.95em;
    max-width: 100%;
    box-sizing: border-box;
}


/* Override the hardcoded inline HTML styles for the time inputs */
.custom-time-wrapper input[type="number"] {
    width: 50px !important;
    padding: 8px 4px !important;
    font-size: 1em !important;
}

.custom-time-wrapper {
    gap: 4px !important;
}


/* Asymmetric Day Cards */
#asymmetricCardsContainer {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed var(--border-light);
}
.day-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-med);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px var(--shadow-color);
}
.day-card h4 {
    margin: 0 0 10px 0;
    color: var(--brand-primary);
    font-size: 1.1rem;
}
.all-day-container {
    background: var(--bg-hover);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.custom-time-picker {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border: 1px solid var(--border-med);
    border-radius: 6px;
    padding: 5px;
    width: 100%;
    box-sizing: border-box;
}
.custom-time-picker input[type="number"] {
    width: 60px !important;
    text-align: center;
    border: none;
    background: var(--bg-hover);
    font-size: 1.2em;
    font-weight: bold;
    padding: 8px;
    border-radius: 4px;
    margin: 0;
    appearance: none;
    -moz-appearance: textfield;
}
.custom-time-picker input[type="number"]::-webkit-outer-spin-button,
.custom-time-picker input[type="number"]::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.custom-time-picker .colon {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-muted);
    margin: 0 4px;
}
.ampm-pills {
    display: flex;
    gap: 4px;
    margin-left: auto;
}
.ampm-btn {
    background: transparent;
    border: 1px solid var(--border-med);
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: bold;
    color: var(--text-muted);
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.ampm-btn.active {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}
/* --- Custom AM/PM Pill Highlighting --- */
.ampm-stack button,
.custom-time-wrapper .am-btn,
.custom-time-wrapper .pm-btn {
    background-color: var(--bg-main, #f0f0f0);
    color: var(--text-muted, #666);
    border: 1px solid var(--border-light, #ccc);
    border-radius: 4px;
    padding: 4px 6px; /* Slightly reduced horizontal padding */
    font-size: 0.8em; /* Slightly smaller text to fit horizontally */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.ampm-stack button.active,
.custom-time-wrapper .am-btn.active,
.custom-time-wrapper .pm-btn.active {
    background-color: var(--brand-primary, #007bff);
    color: white;
    border-color: var(--brand-primary, #007bff);
    font-weight: bold;
    box-shadow: 0 2px 4px var(--shadow-color, rgba(0,0,0,0.1));
}

/* --- WIZARD UI FOR CALENDAR FORM --- */
.wizard-step {
    display: none;
    animation: fadeIn 0.3s;
}
.wizard-step.active {
    display: block;
}
.wizard-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-med, #ccc);
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .desktop-banner-time {
    display: none;
  }
}

/* Modal Header Button Grouping */
.modal-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1; /* Allows this group to take up the left side of the header */
  margin-right: 15px; /* Keeps it from colliding with the Close button */
}

.modal-action-group button {
  flex: 1; /* Forces both buttons to be exactly the same width */
  min-width: 220px; /* Forces them to stack on mobile instead of squishing */
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.recipient-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  min-height: 52px;
  border: 1px solid var(--border-med);
  border-radius: 8px;
  background-color: var(--bg-panel);
}

.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border-med);
  border-radius: 999px;
  background-color: var(--bg-hover);
  color: var(--text-main);
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.recipient-chip input[type="checkbox"] {
  display: none;
}

.recipient-chip:has(input:checked) {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  font-weight: 600;
}

.recipient-chip:has(input:checked)::before {
  content: "✓";
  font-weight: bold;
}