/* Zenkai Design System */
:root {
  --primary: #FF6B35;
  --bg-dark: #1A1A2E;
  --bg-card: #2D2D44;
  --border: #404060;
  --gold: #FFD60A;
  --zenkai-green: #00FF41;
  --electric-blue: #00D4FF;
  --text: #FFFFFF;
  --text-muted: #98FF98;
  --danger: #FF4757;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Typography */
h1, h2, h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
}

/* Header */
.header {
  background: linear-gradient(180deg, rgba(45, 45, 68, 0.8) 0%, transparent 100%);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header .container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 640px) {
  .header .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.logo {
  font-size: 2rem;
  color: var(--primary);
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

/* Power Level Display */
.power-level-display {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 640px) {
  .power-level-display {
    flex-direction: row;
    align-items: center;
    gap: 20px;
  }
}

.power-level-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.power-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.power-number {
  font-family: 'Space Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 214, 10, 0.5);
}

.xp-bar-container {
  width: 100%;
  max-width: 200px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.xp-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.xp-current {
  color: var(--text);
}

.xp-separator {
  margin: 0 4px;
}

.comeback-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 107, 53, 0.2);
  border: 1px solid var(--primary);
  border-radius: 8px;
  animation: pulseGlow 2s infinite;
}

.comeback-badge {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  color: var(--primary);
  letter-spacing: 1px;
}

.comeback-multiplier {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
  }
}

/* Main Content */
.main {
  padding: 24px 0 48px;
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  color: var(--text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #FF8C5A);
  color: var(--text);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-complete {
  background: linear-gradient(135deg, var(--primary), #FF8C5A);
  color: var(--text);
  width: 100%;
}

.btn-complete:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-complete.completed {
  background: linear-gradient(135deg, var(--zenkai-green), #00CC33);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
  pointer-events: none;
}

.btn-icon {
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-comeback {
  background: linear-gradient(135deg, var(--zenkai-green), #00CC33);
  color: var(--bg-dark);
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  padding: 16px 48px;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.4);
}

.btn-comeback:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.6);
}

/* Habits Grid */
.habits-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .habits-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .habits-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Habit Card */
.habit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.2s ease;
}

.habit-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.habit-card.completed {
  border-color: var(--zenkai-green);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

.habit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.habit-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.habit-bonus-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 107, 53, 0.2);
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--primary);
}

.habit-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
  min-height: 42px;
}

.habit-actions {
  display: flex;
  gap: 8px;
}

.btn-delete {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 12px;
  min-width: 48px;
}

.btn-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 8px;
}

/* Activity Section */
.activity-section {
  margin-top: 48px;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 8px;
}

.activity-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 255, 65, 0.2);
  border-radius: 50%;
  color: var(--zenkai-green);
}

.activity-content {
  flex: 1;
}

.activity-habit {
  font-weight: 500;
  color: var(--text);
}

.activity-date {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.activity-xp {
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  color: var(--gold);
}

.activity-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* Modal Base */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 24px;
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

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

/* Comeback Modal */
.comeback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.comeback-modal.active {
  display: flex;
}

.comeback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(8px);
}

.comeback-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.comeback-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

.comeback-inner {
  position: relative;
  z-index: 1;
}

.comeback-title {
  font-size: 2rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 40px rgba(255, 107, 53, 0.5);
  margin-bottom: 40px;
  animation: titleGlow 2s ease-in-out infinite;
}

@media (min-width: 640px) {
  .comeback-title {
    font-size: 3rem;
  }
}

@keyframes titleGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
  }
  50% {
    text-shadow: 0 0 40px rgba(255, 107, 53, 0.8), 0 0 60px rgba(255, 107, 53, 0.4);
  }
}

.comeback-stats {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

@media (min-width: 640px) {
  .comeback-stats {
    flex-direction: row;
    justify-content: center;
  }
}

.comeback-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
}

@media (min-width: 640px) {
  .comeback-stat:not(:last-child) {
    border-right: 1px solid var(--border);
  }
}

.comeback-stat-value {
  font-family: 'Space Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
}

.comeback-multiplier-value {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 214, 10, 0.5);
}

.comeback-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.comeback-message {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto 32px;
}

/* XP Toast */
.xp-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s ease;
}

.xp-toast.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.xp-toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 48px;
  background: rgba(0, 255, 65, 0.2);
  border: 2px solid var(--zenkai-green);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.4);
}

.xp-toast-icon {
  font-family: 'Space Mono', monospace;
  font-size: 2rem;
  color: var(--zenkai-green);
}

.xp-toast-amount {
  font-family: 'Space Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  color: var(--zenkai-green);
  animation: countUp 0.5s ease-out;
}

.xp-toast-label {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  color: var(--zenkai-green);
  text-transform: uppercase;
}

@keyframes countUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Checkmark animation */
.checkmark-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  animation: checkPop 0.3s ease;
}

@keyframes checkPop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* Utility */
.hidden {
  display: none !important;
}
