/* GLOBAL */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --theme: #f9951c;
  --card: #ffffff;
  --text-main: #111111;
  --text-muted: #6b6b6b;
  --border: #e5e7eb;
  --shadow: 0 12px 30px rgba(0,0,0,0.06);
  --radius: 16px;
  --bg: #fafafa;
  --icon-filter: invert(0);
  /* light-mode date icon (black calendar) */
  --date-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="black" viewBox="0 0 24 24"><path d="M19 3h-1V1h-2v2H8V1H6v2H5C3.9 3 3 3.9 3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/></svg>');
}

:root[data-theme='dark'] {
  --bg: #0f0f14;
  --card: #1b1b23;
  --text-main: #ffffff;
  --text-muted: #b0b3b8;
  --border: #2d2d35;
  --shadow: 0 8px 25px rgba(0,0,0,0.4);
  --icon-filter: invert(1);
  /* dark-mode date icon (white calendar) */
  --date-icon: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="%23ffffff" viewBox="0 0 24 24"><path d="M19 3h-1V1h-2v2H8V1H6v2H5C3.9 3 3 3.9 3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/></svg>');
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-main);
  transition: background 0.25s ease, color 0.25s ease;
}


.topbar {
  padding: 1rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  display: flex;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.brand-text {
  font-weight: 600;
}

/* THEME TOGGLE BUTTON */
.theme-toggle {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-main);
  padding: 0.3rem;
  transition: color 0.25s ease;
}

.theme-toggle i {
  transition: transform 0.3s ease, color 0.25s ease;
}
.theme-toggle i:hover {
  color: var(--theme);
}

/* rotate icon when dark mode is active */
body.dark .theme-toggle i {
  transform: rotate(180deg);
}

/* MAIN LAYOUT */
.main {
  padding: 1rem 1.5rem 6rem;
  margin-top: 75px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* TYPOGRAPHY */
h1 {
  font-size: 1.45rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.section-heading {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
}

/* CARDS */
.card, .split-card{
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  transition: background 0.25s ease, border 0.25s ease;
}

/* FORMS */
.form {
  display: flex;
  flex-direction: column;
}

label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

input,
select {
  width: 100%;
  padding: 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--text-main);
  transition: background 0.25s ease, color 0.25s ease, border 0.25s ease;
}

input:focus,
select:focus {
  border-color: var(--theme);
  outline: none;
}

/* number inputs – no ugly spinner background, min 0 handled in JS */
input[type=number] {
  -moz-appearance: textfield;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
  background: transparent;
}

/* date input – custom theme-aware calendar icon */
input[type="date"] {
  position: relative;
  background-image: var(--date-icon);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 18px 18px;
}

/* keep native clickable area but hide its graphic */
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* BUTTONS */
.primary-btn,
.secondary-btn {
  padding: 0.6rem 0.9rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  background: var(--theme);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity 0.25s ease;
}

.primary-btn:hover,
.secondary-btn:hover {
  opacity: 0.9;
}

.full-width {
  width: 100%;
}
.btn-row{
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
}

/* ADD EXERCISE SMALL BUTTON */
#addWorkoutExerciseBtn {
  background: none;
  color: var(--theme);
  margin-top: 0.3rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  width: 50%;
}

#addWorkoutExerciseBtn:hover {
  border: 1px solid var(--theme);
}

/* GRID */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 800px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* SPLIT LIST */
.split-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.split-day-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  width: 170px;
  transition: background 0.25s ease, border 0.25s ease;
}

.split-day-card ul {
  padding-left: 1.1rem;
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* split day header */
.split-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.split-day-edit {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--theme);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.split-day-edit:hover {
  font-size: 0.95rem;
}

/* WORKOUT ROWS */
.exercise-header-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 0.9fr);
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

#workoutExercisesContainer {
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.exercise-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 0.9fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.exercise-row input {
  margin-bottom: 0;
}

.exercise-remove-btn {
  border-radius: 10px;
  border: none;
  background: none;
  color: #f80d0d;
  cursor: pointer;
  padding: 0.3rem 0.55rem;
  font-size: 1rem;
  font-weight: 900;
}
.exercise-remove-btn:hover {
  transform: scale(1.1);
}

.total-volume {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* HISTORY CARDS */
.history-card-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem;
  position: relative;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.history-card-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.history-card-exercise {
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.history-card-volume {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.history-delete-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #dc2626;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.8;
}

.history-delete-icon:hover {
  opacity: 1;
}


.small-muted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* history header edit button */
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-edit-btn {
  background: none;
  border: none;
  color: var(--theme);
  font-size: 1rem;
  cursor: pointer;
}

.history-edit-btn:hover {
  transform: scale(1.2);
}

.history-delete-btn {
  border: 1px solid var(--text-muted);
  background: none;
  color: #b91c1c;
  padding: 0.25rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* PROGRESS – CALENDAR */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  margin-top: 0.4rem;
}

.calendar-day-name,
.calendar-cell {
  font-size: 0.75rem;
  text-align: center;
  padding: 0.3rem 0;
}

.calendar-cell {
  border-radius: 999px;
}

.calendar-cell.empty {
  visibility: hidden;
}

.calendar-cell.has-workout {
  background: var(--theme);
  color: #f9fafb;
}

.calendar-icon {
  filter: var(--icon-filter);
}

.streak-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* BOTTOM NAV (MYTRACKR STYLE) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.4rem 0 0.5rem;
  z-index: 50;
}

.bottom-nav .nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.bottom-nav .nav-btn i {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-nav .nav-btn.active {
  color: var(--theme);
}

/* MODAL */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card);
  padding: 1.4rem;
  border-radius: 16px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

#editExerciseList {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.edit-ex-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.edit-ex-row input {
  flex: 1;
  margin-bottom: 0;
}

.remove-ex-btn {
  border: 1px solid var(--text-muted);
  background: none;
  color: #b91c1c;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.8;
}

.modal-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* HOME SUMMARY CARD */
.home-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.home-week-count {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.home-week-count span:first-child,.num {
  font-size: 1.2rem;
  font-weight: 600;
}

.home-week-label {
  font-size: 0.9rem;
}

.home-total {
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.home-icon-pill {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(249,31,162,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-icon-pill i {
  color: var(--theme);
}

/* badge */
.home-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--theme);
  color: #fff;
}

.home-badge.hidden {
  display: none;
}

/* streak bar */
.home-streak-bar {
  margin-top: 0.2rem;
  margin-bottom: 0.5rem;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #374151;
  overflow: hidden;
}

.home-streak-fill {
  height: 100%;
  width: 0%;
  background: var(--theme);
}

/* weekdays row */
.home-weekdays {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.home-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.home-day-dot {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #6b7280;
  margin-bottom: 0.15rem;
}

.home-day-dot.done {
  background: var(--theme);
  border-color: var(--theme);
}

/* home split header */
.home-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* HOME / PROGRESS TREND HEADER */
.home-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.home-chart-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #fff;
  padding: 0.12rem;
}

.home-toggle-btn {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  color: #6b7280;
}

.home-toggle-btn.active {
  background: #ffffff;
  color: var(--theme);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.brand-logo {
  height: 22px;
  width: auto;
  object-fit: contain;
  transition: filter 0.25s ease;
}

@media (max-width: 450px) {
  .bottom-nav {
    padding-bottom: 2.5rem;
    padding-top: 1rem;
  }
  body{
    padding-bottom: 2.5rem;
  }
}
@media (min-width: 900px) {

  /* Move bottom nav to left sidebar */
  .bottom-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 80px;
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-right: 1px solid var(--border);
    border-top: none;
    padding-top: 1.2rem;
    background: var(--card);
    z-index: 999;
  }

  /* Buttons inside the sidebar */
  .bottom-nav .nav-btn {
    flex-direction: column;
    padding: 1rem 0;
    width: 100%;
  }

  .bottom-nav .nav-btn i {
    margin-bottom: 4px;
  }

  /* Shift all main content to the right */
  .main {
    margin-left: 80px;
    padding-bottom: 2rem;
  }
  /* Shift the header as well */
  .topbar {
    margin-left: 80px;
    width: calc(100% - 80px);
  }
  .card{
    max-width: 80%;
    margin: 0 auto;
    margin-bottom: 1.2rem;
  }
  .view{
    max-width: 80%;
    margin: auto;
  }
  .view1 h1, .view1 p {
    margin-left: 10%;
  }
  .view1{
    max-width: 90%;
  }
}
.home-week-icon {
  color:var(--theme);
  font-size: 0.9rem;
}
.home-week-text {
  margin-left: 5px;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}


.auth-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-main);

  padding: 1rem;
}

.auth-container {
  width: 90%;
  max-width: 600px;
  padding: 2rem 1.8rem;
  text-align: center;
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.auth-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.auth-form input {
  width: 100%;
  padding: 0.9rem;
  margin: 0.45rem 0;
  font-size: 0.95rem;

  border-radius: 12px;
  border: 1px solid var(--border);

  background: var(--card);
  color: var(--text-main);

  transition: border 0.25s ease, background 0.25s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--theme);
}

.auth-btn {
  width: 100%;
  padding: 0.9rem;

  background: var(--theme);     /* FIX: uses GymLog theme */
  color: #fff;

  border-radius: 12px;
  margin-top: 1rem;
  border: none;

  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;

  transition: opacity 0.25s ease, transform 0.1s ease;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-switch {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--theme);
  font-weight: 600;
}

.auth-error {
  background: #ef4444;
  color: #fff;
  padding: 0.7rem;
  border-radius: 10px;
  margin-top: 1rem;
  font-size: 0.85rem;
}

.auth-error.hidden {
  display: none;
}
.auth-container {
  animation: fadeIn 1.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 1rem;
  object-fit: contain;

  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%   { transform: translateY(-20px); }
  50%  { transform: translateY(20px); }
  100% { transform: translateY(-20px); }
}

/* ============================
   PROFILE PAGE
============================ */

.profile-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.pro-input {
  width: 100%;
  padding: 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-main);
  margin-top: 0.25rem;
}

.link-button {
  background: none;
  border: none;
  color: var(--theme);
  margin-top: 0.35rem;
  cursor: pointer;
  font-size: 0.85rem;
  width: 100%;
  text-align: right;
}

.profile-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Delete */
.delete-btn {
  background: #dc2626;
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}


/* Popup */
.success-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 9999;
}

.success-overlay.hidden {
  display: none;
}

.success-card {
  background: var(--card);
  padding: 1rem 1.4rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.success-icon {
  font-size: 1.4rem;
  color: var(--theme);
}

.success-icon.error {
  color: #ef4444;
}
.success-icon.success {
  color: #22c55e;
}

.success-text {
  font-size: 0.9rem;
  color: var(--text-main);
}
.top-bar-side {
  display: flex;
  gap: 0.5rem;
}
.input-error {
  border: 2px solid #ef4444 !important;
}
.field-error-text {
  color: #ef4444;
  font-size: 0.75rem;
  margin: 0;
  padding: 0;
  margin-bottom: 6px;
}
.icon-button {
  border: none;
  background: none;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}
.icon-button i {
  font-size: 1.2rem;
}

.icon-button i:hover {
  color: var(--theme);
}
.icon-button.active {
  color: var(--theme);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close i {
  font-size: 1rem;
}
.view {
  display: none;
}

.view.active {
  display: block;
}


/* PRELOADER BASE */
#preloader {
  display: flex;
}

.spa-preload .view {
  display: none !important;
}

.preloader {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-dumbbell i {
  font-size: 42px;
  color: var(--theme);
  animation: spinLoader 1s linear infinite;
}

@keyframes spinLoader {
  0% { transform: rotate(0deg) scale(1); opacity: 1; }
  50% { transform: rotate(180deg) scale(1.05); opacity: 0.9; }
  100% { transform: rotate(360deg) scale(1); opacity: 1; }
}
.empty-message {
  text-align: center;
  opacity: 0.6;
  margin-top: 8px;
  font-size: 0.8rem;
}
.forgot-link {
  text-align: right;
  margin-top: 8px;
  font-size: 0.85rem;
  opacity: 0.8;
  cursor: pointer;
}
.forgot-link:hover {
  opacity: 1;
}

.challengelist{
  margin-bottom: 3rem;
}
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
}
.challenge-list-empty {
  margin-top: 0.8rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-align: center;
}
.fab-add {
  position: fixed;
  bottom: 7rem;
  right: 20px;
  background: var(--theme);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.challenge-card {
  background: var(--card);
  border-radius: 15px;
  border: 1px solid 10px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
}
.goal-card {
  border-radius: 15px;
  position: relative;
  width: 100%;
  margin: auto;
}
.card-main {
  display: flex;
  gap: 2rem;

}

.challenge-card-text {
  flex: 1;                  /* pushes menu to the end */
}

.challenge-title{
  font-weight: 700;
  font-size: 1.05rem;
}

.challenge-subtitle{
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 0.2rem;
}

.challenge-clock{
  font-size: 0.8rem;
  color: var(--text-muted);
}
.challenge-card-actions {
  position: relative;
}
.challenge-menu-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  opacity: 0.6;
}
.challenge-menu-btn i{
  color: var(--text-main);
  opacity: 0.8;
}
.challenge-menu-btn:hover i {
  opacity: 1;
  transform: scale(1.1);
  transition: 0.15s ease;
}
.challenge-menu-btn {
  margin-left: auto;        /* forces it to the far right */
}
.inline-actions {
  position: absolute;
  bottom: 0;       /* same vertical offset as savings */
  right: 0;        /* same horizontal offset as savings */
  display: flex;
  z-index: 5;
  align-items: center;
}

.inline-actions.hidden {
  display: none;
}

/* Icon buttons */
.challenge-button-only {
  border: none;
  display: flex;
  background:none ;
  cursor: pointer;
}

.challenge-button-only i {
  font-size: 0.9rem;
}
.challenge-button-only:first-child {
  color: var(--text-muted);
}
.challenge-button-only i:hover {
  transform: scale(1.1);
}

.challenge-button-only.danger {
  color: #dc2626 !important;
}
@media (min-width: 600px) {
  .challenge-goal-card {
    width: 80%;

  }
}
/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* Modal card */
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 15px;
  padding: 1rem 1.1rem 0.85rem;
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid 10px;

  /* NEW: keep it on screen + scroll internally */
  max-height: 70vh;
  overflow-y: auto;
}
/* scroll bar styling */
.modal-card::-webkit-scrollbar {
  width: 8px;
}

.modal-card::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 8px;
}

.modal-card::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.25);
}

:root[data-theme="dark"] .modal-card::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.1);
}


/* Modal header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close i {
  font-size: 1rem;
}

/* Modal body */
.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.input {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  background: var(--card);
  color: var(--text-main);
}

.input:focus {
  outline: none;
  border-color: var(--theme);
}
.modal-footer {
  margin-top: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.btn-primary,
.btn-outline {
  border-radius: 10px;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--theme);
  border: none;
  color: white;
}

.btn-primary:hover,
.btn-outline:hover {
  transform: scale(1.05);
}

.btn-outline {
  border: 1px solid #ef4444;
  color: #ef4444;
  background: transparent;
  display: inline-flex;
  align-items: center;
}

/* Hidden */
.hidden {
  display: none !important;
}
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.popup-card {
  background: var(--card);
  border-radius: 18px;
  padding: 1rem 1.2rem;
  width: 88%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  border: 1px solid 10px;
}

.popup-text {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.popup-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.popup-btn {
  flex: 1;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
}

.cancel-btn {
  background: rgba(148,163,184,0.2);
  color: var(--text-main);
}
/* =========================
   CHALLENGE DETAIL VIEW
========================= */

.challenge-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* =========================
   CHALLENGE DAY STRIP
========================= */

.challenge-day-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;

  scrollbar-width: none;
}
.challenge-day-strip::-webkit-scrollbar {
  display: none;
}

.challenge-day {
  position: relative;
  width: 40px;
  height: 48px; /* extra space for dot */

  display: flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;
  cursor: pointer;
}



/* Mini ring */
.challenge-day-ring {
  width: 40px;
  height: 40px;
}

.day-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.day-ring-progress {
  fill: none;
  stroke: var(--theme);
  stroke-width: 4;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.3s ease;
}

/* Day number */
.challenge-day-number {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;

  /* optical centering */
  transform: translateY(0.5px);

  pointer-events: none;
}



/* Selection dot */
.challenge-day-dot {
  position: absolute;
  bottom: -2px;
  left: 50%;

  width: 5px;
  height: 5px;
  border-radius: 50%;

  background: transparent;
  transform: translateX(-50%);
}

.challenge-day.active .challenge-day-dot {
  background: var(--theme);
}



.challenge-ring-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.2rem 0;
}

.challenge-ring {
  width: 160px;
  height: 160px;
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 15;
}

.ring-progress {
  fill: none;
  stroke: var(--theme);
  stroke-width: 15;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.35s ease;
}

.ring-center-text {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.challenge-list-card {
  margin-top: 1.2rem;
}

.challenge-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.challenge-list-actions {
  display: flex;
  gap: 0.3rem;
}

.challenge-item-list {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* =========================
   CHALLENGE ITEM ROW
========================= */

.challenge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

/* LEFT SIDE */
.challenge-item-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* checkbox */
.challenge-item-left input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--theme);
}

/* text */
.challenge-item-text {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

/* RIGHT SIDE */
.delete-item {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  display: none;
}

/* show delete only in edit mode */
.challenge-item.edit-mode .delete-item {
  display: block;
}
.challenge-item input[type="checkbox"]:checked + .challenge-item-text {
  opacity: 0.5;
  text-decoration: line-through;
}



/* =========================
   CHALLENGE CALENDAR OVERLAY
========================= */

.challenge-calendar-modal {
  max-width: 420px;
}

.challenge-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.8rem;
  margin-top: 1rem;
  overflow-y: auto;
  flex: 1;                   /* take remaining height */
  padding-bottom: 0.5rem;
  padding-right: 6px;
}

.challenge-calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
}

.challenge-mini-ring {
  width: 36px;
  height: 36px;
}

.challenge-mini-ring circle {
  fill: none;
  stroke-width: 7;
}

.challenge-mini-bg {
  stroke: var(--border);
}

.challenge-mini-progress {
  stroke: var(--theme);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.3s ease;
}

.challenge-calendar-day span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.challenge-calendar-day.today span {
  color: var(--theme);
  font-weight: 600;
}
#editChallengeItemsBtn.active {
  color: var(--theme);
}
.challenge-day-strip {
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
}

.challenge-day {
  scroll-snap-align: center;
}
.challenge-ring-wrapper {
  position: relative;
}

.challenge-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);

  font-size: 1.2rem;
  font-weight: 600;
  pointer-events: none;
}
.challenge-day.today {
  transform: scale(1.06);
  color: var(--theme);
}

.challenge-calendar-modal {
  max-height: 80vh;          /* never exceed viewport */
  display: flex;
  flex-direction: column;
}
/* WebKit (Chrome, Safari, Edge) */
.challenge-calendar-grid::-webkit-scrollbar {
  width: 6px;
}

.challenge-calendar-grid::-webkit-scrollbar-track {
  background: transparent;
}

.challenge-calendar-grid::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
}

.challenge-calendar-grid::-webkit-scrollbar-thumb:hover {
  background-color: var(--border);
}

/* Firefox */
.challenge-calendar-grid {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
input,
input[type="date"] {
  box-sizing: border-box;
}
input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}
.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.input-with-icon input {
  width: 100%;
  padding-right: 42px; /* space for icon */
}
input{
  font-size: 16px;
}