/* Enjoy AI Town — Creator Analytics Design Tokens & Styles */

:root {
  --enjoy-bg-start: #FFE5E5;
  --enjoy-bg-mid: #FFD4C4;
  --enjoy-bg-end: #FFC4B4;
  --enjoy-text-primary: #4B1F0F;
  --enjoy-text-secondary: #512E11;
  --enjoy-text-muted: #666666;
  --enjoy-surface: #FFFFFF;
  --enjoy-surface-alt: #FCFCFC;
  --enjoy-accent-start: #FFC09E;
  --enjoy-accent-end: #FA5C42;
  --enjoy-red: #C32525;
  --enjoy-green: #2D8B4E;
  --card-padding: 16px;
  --card-gap: 12px;
  --card-radius: 16px;
  --button-radius: 24px;
  --thumb-radius: 8px;
  --shadow: 0 2px 8px rgba(75, 31, 15, 0.08);
  --shadow-active: 0 4px 16px rgba(75, 31, 15, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background-color: var(--enjoy-bg-end);
  background-image: linear-gradient(180deg, var(--enjoy-bg-start), var(--enjoy-bg-mid), var(--enjoy-bg-end));
  background-size: 100% 100vh;
  background-repeat: no-repeat;
  min-height: 100vh;
  color: var(--enjoy-text-primary);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 100vh;
}

/* ── Auth Page ────────────────────────────────────────────────────────── */

.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.auth-logo {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 40px;
  font-style: italic;
  color: var(--enjoy-red);
  margin-bottom: 4px;
}

.enjoy-logo-img {
  object-fit: contain;
}

.enjoy-logo-lg {
  height: 64px;
  width: auto;
  margin-bottom: 4px;
  display: block;
}

.enjoy-logo-sm {
  height: 36px;
  width: auto;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.2;
}

.auth-subtitle {
  color: var(--enjoy-text-secondary);
  font-size: 15px;
  text-align: center;
  margin-bottom: 32px;
}

.auth-card {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  width: 100%;
  max-width: 400px;
}

.auth-field {
  margin-bottom: 20px;
}

.auth-field label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--enjoy-text-primary);
}

.auth-field .input-wrapper {
  position: relative;
}

.auth-field .input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
}

.auth-field input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: none;
  border-radius: 12px;
  background: var(--enjoy-surface);
  box-shadow: var(--shadow);
  font-size: 16px;
  color: var(--enjoy-text-primary);
  outline: none;
  transition: box-shadow 0.15s ease;
}

.auth-field input:focus {
  box-shadow: var(--shadow-active), 0 0 0 2px var(--enjoy-accent-end);
}

.auth-field input::placeholder {
  color: var(--enjoy-text-muted);
}

.auth-hint {
  font-size: 13px;
  color: var(--enjoy-accent-end);
  margin-top: 6px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--enjoy-text-secondary);
}

.auth-remember input[type="checkbox"] {
  accent-color: var(--enjoy-accent-end);
  width: 18px;
  height: 18px;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--button-radius);
  background: linear-gradient(90deg, var(--enjoy-accent-start), var(--enjoy-accent-end));
  color: white;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  min-height: 44px;
}

.btn-primary:hover {
  opacity: 0.95;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  background: #FFF0F0;
  color: var(--enjoy-red);
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
  text-align: center;
}

.auth-error.visible {
  display: block;
}

/* ── Dashboard ────────────────────────────────────────────────────────── */

.dashboard {
  display: none;
  padding: 16px 0 32px;
}

.dashboard.active {
  display: block;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
  margin-bottom: 4px;
}

.back-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--enjoy-text-primary);
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--enjoy-text-secondary);
}

.top-bar-logo {
  height: 28px;
  width: auto;
}

.top-bar-spacer {
  width: 44px;
}

.dash-title {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Wallet Bar (compact) */
.wallet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--enjoy-surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 16px;
  margin-bottom: var(--card-gap);
  min-height: 44px;
}

.wallet-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wallet-bar-label {
  font-size: 13px;
  color: var(--enjoy-text-muted);
}

.wallet-bar-balance {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.wallet-bar-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--enjoy-accent-end);
  text-decoration: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Summary Metrics */
.summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--card-gap);
  margin-bottom: var(--card-gap);
}

.summary-row-2 {
  grid-template-columns: 1fr 1fr;
}

.metric-card {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: var(--card-padding);
  text-align: center;
}

.metric-card-muted {
  opacity: 0.75;
}

.metric-card-muted .metric-value {
  font-size: 18px;
}

.metric-label {
  font-size: 12px;
  color: var(--enjoy-text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-trend {
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}

.metric-trend.up {
  color: var(--enjoy-green);
}

.metric-trend.down {
  color: var(--enjoy-red);
}

/* Period Pills */
.period-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--card-gap);
}

.period-label {
  font-size: 15px;
  font-weight: 600;
  margin-right: auto;
}

.category-select {
  padding: 6px 28px 6px 12px;
  border: 1px solid rgba(75, 31, 15, 0.12);
  border-radius: var(--button-radius);
  background: var(--enjoy-surface);
  color: var(--enjoy-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%234B1F0F' opacity='.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.period-pill {
  padding: 6px 16px;
  border: none;
  border-radius: var(--button-radius);
  background: var(--enjoy-surface);
  color: var(--enjoy-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease;
  min-height: 36px;
}

.period-pill.active {
  background: linear-gradient(90deg, var(--enjoy-accent-start), var(--enjoy-accent-end));
  color: white;
}

/* Chart */
.chart-card {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: var(--card-padding);
  margin-bottom: var(--card-gap);
}

.chart-top-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.chart-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--enjoy-text-muted);
  user-select: none;
}

.chart-toggle input[type="checkbox"] {
  accent-color: var(--enjoy-accent-end);
  width: 16px;
  height: 16px;
}

.chart-toggle-label {
  font-weight: 500;
}

.chart-container {
  position: relative;
  height: 200px;
}

@media (min-width: 768px) {
  .chart-container { height: 280px; }
}

@media (min-width: 1024px) {
  .chart-container { height: 320px; }
}

/* Tabs */
.tab-row {
  display: flex;
  gap: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--enjoy-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  color: var(--enjoy-text-primary);
  border-bottom-color: var(--enjoy-accent-end);
}

/* Items List */
.items-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--card-gap);
}

.items-header {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

/* Future Creations */
.future-intro {
  font-size: 13px;
  color: var(--enjoy-text-muted);
  margin-bottom: 12px;
}

.future-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.future-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid rgba(75, 31, 15, 0.12);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--enjoy-text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.future-input:focus {
  border-color: var(--enjoy-accent-end);
}

.future-add-btn {
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--enjoy-accent-start), var(--enjoy-accent-end));
  color: white;
  border: none;
  border-radius: var(--button-radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.future-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.future-item {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.future-item.done {
  opacity: 0.5;
}

.future-item.done .future-text {
  text-decoration: line-through;
}

.future-check {
  width: 20px;
  height: 20px;
  accent-color: var(--enjoy-accent-end);
  cursor: pointer;
  flex-shrink: 0;
}

.future-text {
  flex: 1;
  font-size: 14px;
  word-break: break-word;
}

.future-delete {
  background: none;
  border: none;
  color: var(--enjoy-red);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.5;
}

.future-delete:hover {
  opacity: 1;
}

.future-empty {
  text-align: center;
  color: var(--enjoy-text-muted);
  font-size: 14px;
  padding: 24px 0;
}

/* Disclaimer */
.disclaimer {
  margin-top: 32px;
  padding: 16px 0;
  text-align: center;
  font-size: 11px;
  color: var(--enjoy-text-muted);
  line-height: 1.5;
}

.disclaimer p {
  margin: 4px 0;
}

.item-row {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: var(--card-padding);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  flex-wrap: wrap;
}

.item-rank {
  font-size: 16px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  color: var(--enjoy-text-muted);
}

.item-rank.top-3 {
  background: linear-gradient(135deg, var(--enjoy-accent-start), var(--enjoy-accent-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 18px;
}

.item-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--thumb-radius);
  background: var(--enjoy-bg-start);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-category {
  font-size: 12px;
  color: var(--enjoy-text-muted);
  margin-top: 2px;
}

.item-stats {
  text-align: right;
  flex-shrink: 0;
}

.item-sales {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.item-trend {
  font-size: 13px;
  font-weight: 500;
}

.item-trend.up {
  color: var(--enjoy-green);
}

.item-trend.down {
  color: var(--enjoy-red);
}

/* Item Notes */
.item-note-row {
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid rgba(75, 31, 15, 0.06);
  margin-top: 4px;
}

.item-note-text {
  font-size: 13px;
  color: var(--enjoy-text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-note-link {
  font-size: 12px;
  color: var(--enjoy-accent-end);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: 500;
}

.item-note-link:hover {
  text-decoration: underline;
}

/* Note Modal */
.note-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.note-modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.note-modal {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  transform: translateY(16px);
  transition: transform 0.2s ease;
}

.note-modal-overlay.visible .note-modal {
  transform: translateY(0);
}

.note-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--enjoy-text-primary);
  margin-bottom: 4px;
}

.note-modal-hint {
  font-size: 13px;
  color: var(--enjoy-text-muted);
  margin-bottom: 16px;
}

.note-modal textarea {
  width: 100%;
  min-height: 100px;
  border: 1.5px solid rgba(75, 31, 15, 0.12);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--enjoy-text-primary);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.note-modal textarea:focus {
  border-color: var(--enjoy-accent-end);
}

.note-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.note-btn {
  padding: 10px 20px;
  border-radius: var(--button-radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.note-btn:hover {
  opacity: 0.85;
}

.note-btn-save {
  background: linear-gradient(135deg, var(--enjoy-accent-start), var(--enjoy-accent-end));
  color: white;
}

.note-btn-cancel {
  background: rgba(75, 31, 15, 0.06);
  color: var(--enjoy-text-primary);
}

.note-btn-clear {
  background: none;
  color: var(--enjoy-red);
  margin-right: auto;
  padding-left: 4px;
  padding-right: 4px;
}

/* Shimmer Loading */
.shimmer {
  background: linear-gradient(90deg,
    rgba(255, 212, 196, 0.3) 25%,
    rgba(255, 196, 180, 0.5) 50%,
    rgba(255, 212, 196, 0.3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--card-radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.shimmer-card {
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: var(--card-padding);
  margin-bottom: var(--card-gap);
}

.shimmer-line {
  height: 16px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.shimmer-line.w-60 { width: 60%; }
.shimmer-line.w-40 { width: 40%; }
.shimmer-line.w-80 { width: 80%; }
.shimmer-line.tall { height: 32px; }
.shimmer-line.chart { height: 200px; border-radius: 12px; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-text {
  color: var(--enjoy-text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 32px 24px;
  background: var(--enjoy-surface);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.error-state-text {
  color: var(--enjoy-text-secondary);
  font-size: 15px;
  margin-bottom: 16px;
}

.btn-retry {
  padding: 10px 24px;
  border: none;
  border-radius: var(--button-radius);
  background: var(--enjoy-surface);
  color: var(--enjoy-accent-end);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Loading Spinner */
.loading-more {
  text-align: center;
  padding: 16px;
  color: var(--enjoy-text-muted);
  font-size: 14px;
}

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

/* Focus ring for keyboard nav */
*:focus-visible {
  outline: 2px solid var(--enjoy-accent-end);
  outline-offset: 2px;
}
