/* ==========================================================================
   ELITE HABIT TRACKER CSS
   Deep dark matrix, Glassmorphism, Compounding visual cues
   ========================================================================== */

/* Layout & Globals */
.habits-container {
  margin-left: 20px;
  padding: 32px;
  min-height: 100vh;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.text-muted { color: rgba(255, 255, 255, 0.6); }
.text-gold { color: #fbbf24; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Animations */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes checkboxPop { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes flicker { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.05); } }

.fade-in { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.flame-anim { animation: flicker 2s infinite ease-in-out; display: inline-block; }

/* Header Elements */
.habits-header { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 24px; }
.habits-header__title { font-size: 2.5rem; font-weight: 800; margin: 0 0 8px 0; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.habits-header__subtitle { color: #c084fc; margin: 0; font-size: 1rem; }
.habits-header__stats { display: flex; gap: 24px; }
.habits-stat-card { text-align: center; }
.habits-stat-val { display: block; font-size: 1.5rem; font-weight: 700; }
.habits-stat-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; }

/* Buttons & Inputs */
.habits-btn { padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: all 0.3s ease; border: none; text-transform: uppercase; }
.habits-btn--primary { background: linear-gradient(135deg, #a855f7, #7e22ce); color: white; box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.habits-btn--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5); }
.habits-btn--secondary { background: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); }
.habits-btn--secondary:hover { background: rgba(255,255,255,0.1); }
.habits-btn--success { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.habits-btn--ghost { background: transparent; color: rgba(255,255,255,0.6); }

.habits-input, .habits-select { width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 8px; transition: 0.3s; }
.habits-input:focus, .habits-select:focus { outline: none; border-color: #c084fc; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.8); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Today's Checklist */
.habits-today { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; padding: 32px; backdrop-filter: blur(16px); }
.habits-today__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.habits-today__date { font-size: 1.5rem; font-weight: 700; color: #c084fc; }
.habits-today__progress-wrapper { width: 300px; text-align: right; }
.habits-today__progress-text { font-size: 0.85rem; margin-bottom: 8px; display: block; color: rgba(255,255,255,0.7); }
.habits-today__progress-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.habits-today__progress-fill { height: 100%; background: #22c55e; border-radius: 4px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 0 10px rgba(34,197,94,0.5); }

.habits-group-title { font-size: 0.85rem; text-transform: uppercase; color: rgba(255,255,255,0.5); letter-spacing: 1px; margin: 24px 0 12px 0; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; }

.habit-todo-item { display: flex; align-items: center; padding: 16px; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; margin-bottom: 8px; transition: all 0.3s ease; }
.habit-todo-item:hover { background: rgba(255,255,255,0.05); transform: translateX(4px); border-color: rgba(192,132,252,0.3); }
.habit-todo-item--done { background: rgba(34,197,94,0.05); border-color: rgba(34,197,94,0.3); }

/* The Elite Checkbox */
.habits-checkbox { appearance: none; width: 28px; height: 28px; border: 2px solid rgba(255,255,255,0.3); border-radius: 8px; cursor: pointer; position: relative; transition: all 0.2s; margin-right: 16px; flex-shrink: 0; }
.habits-checkbox:checked { background: #22c55e; border-color: #22c55e; animation: checkboxPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.habits-checkbox:checked::after { content: '✔'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #020005; font-size: 16px; font-weight: 900; }

.habit-todo-info { flex-grow: 1; }
.habit-todo-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 4px 0; }
.habit-todo-streak { font-size: 0.8rem; color: #fbbf24; }
.habit-todo-action { font-size: 0.85rem; color: rgba(255,255,255,0.4); }

/* Section Titles */
.habits-section-title { font-size: 1.5rem; margin: 0 0 24px 0; display: flex; align-items: center; gap: 12px; }

/* Keystone Impact Grid */
.habits-keystone__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.habit-card-impact { background: rgba(20,15,25,0.85); border: 1px solid rgba(251,191,36,0.3); border-radius: 16px; padding: 24px; position: relative; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.3); transition: transform 0.3s; }
.habit-card-impact:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(251,191,36,0.15); }
.habit-card-impact::before { content: ''; position: absolute; top:0; right:0; width: 100px; height: 100px; background: radial-gradient(circle, rgba(251,191,36,0.2) 0%, transparent 70%); }
.impact-metric { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; background: rgba(0,0,0,0.3); padding: 12px; border-radius: 8px; border-left: 3px solid #22c55e; }
.impact-val { font-size: 1.2rem; font-weight: 800; color: #22c55e; }

/* All Habits Grid */
.habits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.habit-card { background: rgba(255,255,255,0.03); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 24px; cursor: pointer; transition: all 0.3s; }
.habit-card:hover { border-color: #c084fc; background: rgba(255,255,255,0.06); transform: translateY(-4px); }
.habit-card__header { display: flex; justify-content: space-between; margin-bottom: 16px; }
.habit-card__title { font-size: 1.1rem; font-weight: 600; margin: 0; display: flex; gap: 8px; align-items: center; }
.habit-card__chips { display: flex; gap: 8px; margin-bottom: 16px; }
.habit-chip { font-size: 0.7rem; padding: 4px 8px; border-radius: 6px; background: rgba(255,255,255,0.1); text-transform: uppercase; }

/* Mini Heatmap (Last 7 days) */
.mini-heatmap { display: flex; gap: 4px; margin: 16px 0; }
.mini-day { width: 16px; height: 16px; border-radius: 4px; background: rgba(255,255,255,0.1); }
.mini-day--done { background: #22c55e; box-shadow: 0 0 5px rgba(34,197,94,0.5); }
.mini-day--skip { background: rgba(255,255,255,0.05); }

/* Heatmap Grid (Detail Modal) */
.heatmap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16px, 1fr)); gap: 4px; margin-top: 16px; }
.heatmap-cell { width: 16px; height: 16px; border-radius: 4px; background: rgba(255,255,255,0.1); position: relative; cursor: pointer; }
.heatmap-cell--done { background: #22c55e; }
.heatmap-cell:hover::after { content: attr(data-tooltip); position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background: #000; padding: 4px 8px; font-size: 0.7rem; border-radius: 4px; white-space: nowrap; z-index: 10; pointer-events: none; border: 1px solid rgba(255,255,255,0.2); }

/* Modals */
.habits-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.habits-modal__overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); }
.habits-modal__content { position: relative; background: #0d0b12; border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); animation: fadeInUp 0.3s ease-out forwards; }
.habits-modal__close { position: absolute; top: 24px; right: 24px; background: none; border: none; color: rgba(255,255,255,0.5); font-size: 1.5rem; cursor: pointer; transition: color 0.3s; }
.habits-modal__close:hover { color: white; }

/* Wizard */
.habits-wizard { max-width: 800px; padding: 0; display: flex; flex-direction: column; }
.habits-wizard__header { padding: 32px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.habits-wizard__header h2 { margin: 0 0 16px 0; color: #c084fc; }
.habits-wizard__progress { width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; }
.habits-wizard__progress-bar { width: 33%; height: 100%; background: #c084fc; transition: width 0.4s ease; }
.habits-wizard__body { padding: 32px; min-height: 350px; }
.habits-wizard__footer { padding: 16px 32px; border-top: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; background: rgba(0,0,0,0.2); }

.habits-template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.template-card { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); padding: 16px; border-radius: 12px; cursor: pointer; transition: 0.3s; }
.template-card:hover, .template-card.selected { border-color: #c084fc; background: rgba(192,132,252,0.1); }