/* challenge.css */

.challenge-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  color: var(--text);
  font-family: inherit;
}

/* Header & Progress Stats */
.challenge-header {
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.challenge-title-block h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.challenge-title-block p {
  font-size: 11px;
  color: var(--text2);
}

.challenge-stats {
  display: flex;
  gap: 12px;
}

.challenge-stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
  min-width: 90px;
}

.challenge-stat-card .num {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.challenge-stat-card .lbl {
  font-size: 9px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Body Layout */
.challenge-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

/* Active Quest Card */
.active-quest-area {
  width: 100%;
  max-width: 440px;
}

.active-quest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: questCardLoad 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes questCardLoad {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.quest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quest-phase-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
}

.quest-day-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.5px;
}

.quest-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  font-weight: 500;
}

.quest-note-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quest-note-section label {
  font-size: 10px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.quest-note-section textarea {
  resize: none;
  font-size: 12px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.quest-action-btn {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}

/* Celebration Card */
.quest-celebration-card {
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 440px;
  animation: questCardLoad 0.4s ease;
}

.quest-celebration-card h2 {
  color: var(--green);
  font-size: 20px;
  font-weight: 700;
}

/* History Section */
.challenge-history-section {
  width: 100%;
  max-width: 440px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.challenge-history-section h3 {
  font-size: 12px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.challenge-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 80px 1fr 100px;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-item-row:hover {
  background: var(--surface2);
}

.history-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.history-day-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
}

.history-challenge-preview {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-note-snippet {
  font-size: 10px;
  color: #c5a059;
  background: rgba(197, 160, 89, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.history-note-empty {
  font-size: 10px;
  color: var(--text3);
  font-style: italic;
  text-align: right;
}

/* Modal styling */
.challenge-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.challenge-modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15);
  color: var(--text);
}

.challenge-modal-header {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

.challenge-modal-close {
  background: transparent;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.challenge-modal-close:hover {
  color: var(--text);
}

.challenge-modal-body {
  padding: 18px;
}

.challenge-modal-phase-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  color: #fff;
}

.challenge-modal-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 20px;
}

.challenge-modal-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Custom Checkbox Toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface2);
  transition: .2s;
  border-radius: 24px;
  border: 1px solid var(--border);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text2);
  transition: .2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--green);
  border-color: var(--green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: #fff;
}

/* Override thoughts.css .transparent-input white text conflicts in light theme */
.challenge-container textarea.transparent-input,
.challenge-container input.transparent-input {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: inherit !important;
}

.challenge-container textarea.transparent-input:focus,
.challenge-container input.transparent-input:focus {
  background: var(--surface) !important;
  border-color: var(--accent) !important;
}

.challenge-container textarea.transparent-input::placeholder {
  color: var(--text3) !important;
}
