



.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}


.modal-overlay {
  position: fixed; /* CRITICAL: Breaks it out of the parent container */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(38, 42, 44, 0.278);
  backdrop-filter: blur(4px);
  
  /* Centers the modal card perfectly */
  display: flex;
  justify-content: center;
  align-items: center;
  
  box-sizing: border-box;
  animation: slideUp 0.25s ease-out;

  
  z-index: 9999; /* Now that it's fixed, this will actually beat the navbar */
}

.modal-overlay.hidden { display: none; }




.modal-overlay.hidden {
  display: none;
}




.modal h2 {
  font-size: 22px;
  margin-bottom: 8px;
  color: var(--text-main);
}


.modal label {
  display: block;
  font-size: 14px;
  font-size: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  margin: 12px 0 4px;
}
.modal label svg{
    margin-bottom: 1px;
}

.modal input {
  width: 100%;
  padding: 12px;
  border: none;
  background-color: #ebebef;
  border-radius:8px;
  font-size: 15px;
  outline: none;
}
#med-time{
    width: 90%;
}

.modal select {
  width: 100%;
  padding: 12px 10px;
  border: none;
  background-color: #ebebef;
  border-radius:8px;
  font-size: 15px;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}
/* Modal Management Section */
.modal-divider {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}



.modal-med-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
}


.modal-med-item .med-info {
  display: flex;
  flex-direction: column;
}
.modal-med-item .med-info span {
  font-size: 0.8rem;
  color: #94a3b8;
}



.modal-header h3 { margin: 0; color: #0f172a; font-size: 1.2rem; }

.close-btn {
  background: #f1f5f9;
  border: none;
  font-size: 1.2rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  color: #64748b;
}

.form-group {
  display: flex;
  flex-direction: column;
}


.form-row {
  display: flex;
  gap: 12px;
}

.form-group.half { flex: 1; }



.form-group input,
.form-group select,
.form-group textarea {
  background: #ebebef;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size:11px;
  color: #0f172a;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #2563eb;
  background: #ffffff;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}






.reminder-chip {/* Matches pink theme accent */
  color: var(--text-2);
  cursor: pointer;
  user-select: none;

}
.reminder-chip input {
  display: none; /* Hide default checkbox */
}
.reminder-chip input:checked + .chip-bubble {
  background: var(--blue-accent); /* Matches pink theme accent */
  color: #ffffff;
  border-color: var(--blue-accent);
  transform: translateY(-1px);
}

.reminder-chips-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 8px;
  margin-top: -8px;
  transition: all 0.2s ease;

}

.reminder-chip .chip-bubble {
  background-color: #ebebef;
  user-select: none;
  color: var(--text-2);
  padding: 10px 12px;  
  font-size: 14px; 
  border-radius: 8px;
  transition: all 0.1s ease;
}




/* --- Condensed 2-Column Form Rows --- */
.form-row-2col {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
}

.form-row-2col .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.time-reminder-row {
  align-items: flex-end; /* Aligns input and toggle visually */
}

.flex-grow {
  flex: 1;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.toggle-group label {
  margin-bottom: 8px !important;
}




/* --- Interactive Icon Stage Container --- */
.med-picker-stage {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: var(--bg-color); /* Dynamically matches selected color */
  border-radius: 20px;
  margin: 14px 0 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  transition: background-color 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Viewport & Slide Track */
.stage-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.stage-slider {
  display: flex;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.stage-slide-item {
  min-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stage-slide-item img {
  width: 124px;
  height: auto;
  object-fit: contain;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stage-slide-item.active img {
  transform: scale(1.08);
}

/* Side Navigation Arrows */
.stage-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 34px;
  font-weight: 300;
  padding: 10px 14px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.15s ease, transform 0.1s ease;
}

.stage-nav-btn:active {
  color: #ffffff;
  transform: translateY(-50%) scale(0.9);
}

.stage-nav-prev { left: 4px; }
.stage-nav-next { right: 4px; }

/* Palette Button & Invisible Native Color Input */
.stage-palette-trigger {
  position: absolute;
  bottom: 10px;
  right: 14px;
  z-index: 10;
}

.palette-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.108);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, background-color 0.15s ease;
  position: relative;
  overflow: hidden;
}
.palette-circle-btn svg{
  height: 38px;
  width: auto;
  color: var(--text-3);
}

.palette-circle-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.4);
}

#med-native-color-picker {
  position: absolute;
  top: -50px;
  left: -50px;
  width: 150px;
  height: 150px;
  opacity: 0;
  cursor: pointer;
}
