/**
 * GymDiet Master — Unified Modal Design System
 * Enforces a single, coherent Dark Neon Luxury design language across all modals, sheets, and popups.
 */

/* 1. Universal Modal Overlay / Backdrop */
:root:not([data-theme='light']) .profile-modal,
:root:not([data-theme='light']) .modal-overlay,
:root:not([data-theme='light']) .anti-binge-overlay,
:root:not([data-theme='light']) .custom-confirm-overlay,
:root:not([data-theme='light']) .plate-calculator-overlay,
:root:not([data-theme='light']) .warmup-modal-overlay,
:root:not([data-theme='light']) .exercise-swap-overlay,
:root:not([data-theme='light']) .habits-modal-overlay,
:root:not([data-theme='light']) .notes-modal-overlay,
:root:not([data-theme='light']) .barcode-modal-overlay,
:root:not([data-theme='light']) .profile-modal-backdrop,
:root:not([data-theme='light']) .ac-history-modal-backdrop,
:root:not([data-theme='light']) .activity-day-modal-overlay,
:root:not([data-theme='light']) #modal-activity-day {
  background: rgba(4, 8, 14, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  transition: opacity 0.25s ease-out !important;
}

/* 2. Universal Sheet / Card Surface */
:root:not([data-theme='light']) .profile-modal-sheet,
:root:not([data-theme='light']) .anti-binge-card,
:root:not([data-theme='light']) .custom-confirm-card,
:root:not([data-theme='light']) .barcode-modal-content,
:root:not([data-theme='light']) .warmup-modal-content,
:root:not([data-theme='light']) .exercise-swap-content,
:root:not([data-theme='light']) .plate-calc-sheet,
:root:not([data-theme='light']) .habits-modal-sheet,
:root:not([data-theme='light']) .notes-modal-sheet,
:root:not([data-theme='light']) .family-goal-modal__card,
:root:not([data-theme='light']) .activity-day-modal-content,
:root:not([data-theme='light']) #ac-history-modal .profile-modal-sheet,
:root:not([data-theme='light']) #referral-modal .profile-modal-sheet,
:root:not([data-theme='light']) #app-notifications-modal .profile-modal-sheet,
:root:not([data-theme='light']) #profile-edit-modal .profile-modal-sheet,
:root:not([data-theme='light']) #achievements-modal .profile-modal-sheet {
  background: linear-gradient(180deg, #131922 0%, #0c1017 100%) !important;
  border: 1px solid rgba(0, 240, 118, 0.22) !important;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 240, 118, 0.08) !important;
  color: #ffffff !important;
  font-family: inherit !important;
  box-sizing: border-box !important;
}

/* Bottom sheets border radius */
.profile-modal-sheet,
.plate-calc-sheet,
.habits-modal-sheet,
.notes-modal-sheet,
.activity-day-modal-content {
  border-radius: 24px 24px 0 0 !important;
  border-bottom: none !important;
}

/* Centered modals border radius */
.anti-binge-card,
.custom-confirm-card,
.barcode-modal-content,
.warmup-modal-content,
.exercise-swap-content,
.family-goal-modal__card {
  border-radius: 24px !important;
}

/* 3. Drag Handle / Top Grab Indicator */
.profile-modal-sheet::before,
.plate-calc-sheet::before,
.habits-modal-sheet::before,
.notes-modal-sheet::before {
  content: '' !important;
  display: block !important;
  width: 42px !important;
  height: 4px !important;
  background: rgba(255, 255, 255, 0.22) !important;
  border-radius: 9999px !important;
  margin: 10px auto 14px auto !important;
}

/* 4. Unified Headers & Typography */
.profile-modal-head,
.anti-binge-header,
.modal-header,
.sheet-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  margin-bottom: 16px !important;
}

.profile-modal-head-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}

.profile-head-save-btn {
  padding: 6px 14px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  border-radius: 10px !important;
  min-height: 32px !important;
  background: #00f076 !important;
  color: #04120b !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(0, 240, 118, 0.3) !important;
}

.profile-modal-kicker,
.anti-binge-badge,
.modal-kicker,
.family-goal-modal__eyebrow {
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #00f076 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  margin-bottom: 4px !important;
  display: block !important;
}

.profile-modal-heading,
.anti-binge-title,
.modal-title,
.family-goal-modal__title {
  font-size: 20px !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  letter-spacing: -0.01em !important;
  line-height: 1.25 !important;
  margin: 0 !important;
}

.profile-modal-sub,
.anti-binge-sub,
.modal-subtitle,
.family-goal-modal__text {
  font-size: 13px !important;
  color: #94a3b8 !important;
  line-height: 1.4 !important;
  margin-top: 4px !important;
}

/* 5. Unified Circular Close Buttons */
.profile-modal-close,
.anti-binge-close,
.modal-close,
.sheet-close-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
  font-size: 20px !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  padding: 0 !important;
}

.profile-modal-close:hover,
.anti-binge-close:hover,
.modal-close:hover,
.sheet-close-btn:hover {
  color: #00f076 !important;
  border-color: rgba(0, 240, 118, 0.4) !important;
  background: rgba(0, 240, 118, 0.1) !important;
  transform: scale(1.05);
}

/* 6. Form Fields & Inputs inside Modals */
.profile-modal-sheet input,
.profile-modal-sheet select,
.profile-modal-sheet textarea,
.modal-sheet input,
.modal-sheet select,
.modal-sheet textarea,
.anti-binge-card input,
.anti-binge-card select {
  background: rgba(11, 15, 25, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  font-size: 15px !important;
  padding: 12px 14px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  box-sizing: border-box !important;
}

.profile-modal-sheet input:focus,
.profile-modal-sheet select:focus,
.profile-modal-sheet textarea:focus {
  border-color: #00f076 !important;
  box-shadow: 0 0 0 2px rgba(0, 240, 118, 0.25) !important;
  outline: none !important;
}

/* 7. Action Buttons inside Modals */
.profile-modal-actions,
.modal-actions,
.family-goal-modal__actions {
  display: flex !important;
  gap: 10px !important;
  margin-top: 20px !important;
}

.profile-modal-actions .btn-primary,
.modal-actions .btn-primary,
.family-goal-modal__button--primary {
  background: #00f076 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-radius: 14px !important;
  padding: 13px 20px !important;
  font-size: 15px !important;
  border: none !important;
  box-shadow: 0 4px 18px rgba(0, 240, 118, 0.35) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.profile-modal-actions .btn-primary:active,
.modal-actions .btn-primary:active {
  transform: scale(0.97) !important;
  box-shadow: 0 2px 10px rgba(0, 240, 118, 0.2) !important;
}

.profile-modal-actions .btn-secondary,
.modal-actions .btn-secondary,
.family-goal-modal__button:not(.family-goal-modal__button--primary) {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 13px 20px !important;
  font-size: 15px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.profile-modal-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* ── LIGHT THEME FOR UNIFIED MODALS ── */
html[data-theme="light"] .profile-modal,
html[data-theme="light"] .modal-overlay,
html[data-theme="light"] .anti-binge-overlay,
html[data-theme="light"] .custom-confirm-overlay,
html[data-theme="light"] .plate-calculator-overlay,
html[data-theme="light"] .warmup-modal-overlay,
html[data-theme="light"] .exercise-swap-overlay,
html[data-theme="light"] .habits-modal-overlay,
html[data-theme="light"] .notes-modal-overlay,
html[data-theme="light"] .barcode-modal-overlay,
html[data-theme="light"] .profile-modal-backdrop,
html[data-theme="light"] .ac-history-modal-backdrop,
body.light-theme .profile-modal,
body.light-theme .modal-overlay,
body.light-theme .anti-binge-overlay,
body.light-theme .custom-confirm-overlay,
body.light-theme .plate-calculator-overlay,
body.light-theme .warmup-modal-overlay,
body.light-theme .exercise-swap-overlay,
body.light-theme .habits-modal-overlay,
body.light-theme .notes-modal-overlay,
body.light-theme .barcode-modal-overlay,
body.light-theme .profile-modal-backdrop,
body.light-theme .ac-history-modal-backdrop {
  background: rgba(15, 23, 42, 0.45) !important;
}

html[data-theme="light"] .profile-modal-sheet,
html[data-theme="light"] .anti-binge-card,
html[data-theme="light"] .custom-confirm-card,
html[data-theme="light"] .barcode-modal-content,
html[data-theme="light"] .warmup-modal-content,
html[data-theme="light"] .exercise-swap-content,
html[data-theme="light"] .plate-calc-sheet,
html[data-theme="light"] .habits-modal-sheet,
html[data-theme="light"] .notes-modal-sheet,
html[data-theme="light"] .family-goal-modal__card,
html[data-theme="light"] .unified-modal-card,
html[data-theme="light"] #ac-history-modal .profile-modal-sheet,
html[data-theme="light"] #referral-modal .profile-modal-sheet,
html[data-theme="light"] #app-notifications-modal .profile-modal-sheet,
html[data-theme="light"] #profile-edit-modal .profile-modal-sheet,
html[data-theme="light"] #achievements-modal .profile-modal-sheet,
body.light-theme .profile-modal-sheet,
body.light-theme .anti-binge-card,
body.light-theme .custom-confirm-card,
body.light-theme .barcode-modal-content,
body.light-theme .warmup-modal-content,
body.light-theme .exercise-swap-content,
body.light-theme .plate-calc-sheet,
body.light-theme .habits-modal-sheet,
body.light-theme .notes-modal-sheet,
body.light-theme .family-goal-modal__card,
body.light-theme .unified-modal-card,
body.light-theme #ac-history-modal .profile-modal-sheet,
body.light-theme #referral-modal .profile-modal-sheet,
body.light-theme #app-notifications-modal .profile-modal-sheet,
body.light-theme #profile-edit-modal .profile-modal-sheet,
body.light-theme #achievements-modal .profile-modal-sheet {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15) !important;
  color: #000000 !important;
}

html[data-theme="light"] .profile-modal-heading,
html[data-theme="light"] .anti-binge-title,
html[data-theme="light"] .modal-title,
html[data-theme="light"] .family-goal-modal__title,
body.light-theme .profile-modal-heading,
body.light-theme .anti-binge-title,
body.light-theme .modal-title,
body.light-theme .family-goal-modal__title {
  color: #000000 !important;
}

html[data-theme="light"] .profile-modal-sub,
html[data-theme="light"] .anti-binge-sub,
html[data-theme="light"] .modal-subtitle,
html[data-theme="light"] .family-goal-modal__text,
body.light-theme .profile-modal-sub,
body.light-theme .anti-binge-sub,
body.light-theme .modal-subtitle,
body.light-theme .family-goal-modal__text {
  color: #64748b !important;
}

html[data-theme="light"] .profile-modal-sheet::before,
html[data-theme="light"] .plate-calc-sheet::before,
html[data-theme="light"] .habits-modal-sheet::before,
html[data-theme="light"] .notes-modal-sheet::before,
body.light-theme .profile-modal-sheet::before,
body.light-theme .plate-calc-sheet::before,
body.light-theme .habits-modal-sheet::before,
body.light-theme .notes-modal-sheet::before {
  background: #cbd5e1 !important;
}

html[data-theme="light"] .profile-modal-close,
html[data-theme="light"] .anti-binge-close,
html[data-theme="light"] .modal-close,
html[data-theme="light"] .sheet-close-btn,
body.light-theme .profile-modal-close,
body.light-theme .anti-binge-close,
body.light-theme .modal-close,
body.light-theme .sheet-close-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #64748b !important;
}

html[data-theme="light"] .profile-modal-close:hover,
html[data-theme="light"] .anti-binge-close:hover,
html[data-theme="light"] .modal-close:hover,
html[data-theme="light"] .sheet-close-btn:hover,
body.light-theme .profile-modal-close:hover,
body.light-theme .anti-binge-close:hover,
body.light-theme .modal-close:hover,
body.light-theme .sheet-close-btn:hover {
  color: #000000 !important;
  background: #e2e8f0 !important;
}

html[data-theme="light"] .profile-modal-sheet input,
html[data-theme="light"] .profile-modal-sheet select,
html[data-theme="light"] .profile-modal-sheet textarea,
html[data-theme="light"] .modal-sheet input,
html[data-theme="light"] .modal-sheet select,
html[data-theme="light"] .modal-sheet textarea,
html[data-theme="light"] .anti-binge-card input,
html[data-theme="light"] .anti-binge-card select,
html[data-theme="light"] .unified-modal-card input,
html[data-theme="light"] .unified-modal-card select,
html[data-theme="light"] .unified-modal-card textarea,
body.light-theme .profile-modal-sheet input,
body.light-theme .profile-modal-sheet select,
body.light-theme .profile-modal-sheet textarea,
body.light-theme .modal-sheet input,
body.light-theme .modal-sheet select,
body.light-theme .modal-sheet textarea,
body.light-theme .anti-binge-card input,
body.light-theme .anti-binge-card select,
body.light-theme .unified-modal-card input,
body.light-theme .unified-modal-card select,
body.light-theme .unified-modal-card textarea {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #000000 !important;
}

html[data-theme="light"] .profile-modal-actions .btn-secondary,
html[data-theme="light"] .modal-actions .btn-secondary,
html[data-theme="light"] .family-goal-modal__button:not(.family-goal-modal__button--primary),
body.light-theme .profile-modal-actions .btn-secondary,
body.light-theme .modal-actions .btn-secondary,
body.light-theme .family-goal-modal__button:not(.family-goal-modal__button--primary) {
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #000000 !important;
  font-weight: 700 !important;
}

#reminder-modal:not(.open) {
  display: none !important;
}
#reminder-modal.open {
  display: flex !important;
}

/* --- Activity Day Heatmap Modal Specific Styles --- */
.activity-day-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  align-items: flex-end !important;
  justify-content: center !important;
}

:root:not([data-theme='light']) .activity-day-modal-overlay {
  background: rgba(0, 0, 0, 0.85) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

:root:not([data-theme='light']) .activity-day-modal-content {
  background: linear-gradient(180deg, #0e1524 0%, #060a12 100%) !important;
  border-top: 1px solid rgba(0, 240, 118, 0.35) !important;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.85) !important;
  color: #ffffff !important;
}

:root:not([data-theme='light']) .act-modal-row {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: #cbd5e1 !important;
}

:root:not([data-theme='light']) .act-modal-sub-btn {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

:root:not([data-theme='light']) .act-modal-close-btn {
  color: #94a3b8 !important;
}


