:root {
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark: #5b21b6;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg: #0f0e17;
  --bg-card: #1a1830;
  --bg-card-hover: #231f42;
  --bg-input: #16142a;
  --text: #f0eef6;
  --text-muted: #9b95b0;
  --text-dim: #6b6580;
  --success: #22c55e;
  --danger: #ef4444;
  --maybe: #f59e0b;
  --border: #2d2953;
  --shadow: rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --font: 'Nunito', sans-serif;
  --font-display: 'Righteous', cursive;
  --orb1: rgba(124, 58, 237, 0.15);
  --orb2: rgba(245, 158, 11, 0.1);
  --orb3: rgba(34, 197, 94, 0.08);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden-input {
  display: none;
}

/* Ambient orbs */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: var(--orb1);
  top: -100px;
  left: -100px;
}
.orb-2 {
  width: 400px;
  height: 400px;
  background: var(--orb2);
  bottom: -80px;
  right: -80px;
}
.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--orb3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.app-shell {
  position: relative;
  z-index: 1;
}

.app-wrapper {
  display: flex;
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 24px;
  gap: 36px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* LEFT PANEL */
.left-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* User Badge */
.user-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
}

.user-avatar-wrap {
  position: relative;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.user-avatar-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-initials {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}

.avatar-upload-btn {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}
.avatar-upload-btn:hover {
  transform: scale(1.15);
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 700;
  font-size: 15px;
}

.user-status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Hero */
.hero-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  border: 1px solid var(--border);
}

.hero-dice {
  font-size: 56px;
  margin-bottom: 8px;
  animation: diceFloat 3s ease-in-out infinite;
}
@keyframes diceFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(10deg); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.2;
  color: var(--text);
}

.hero-title-accent {
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-muted);
  margin: 12px 0 24px;
  font-size: 14px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-host {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}
.btn-host:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.4);
}

.btn-rsvp {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-rsvp:hover {
  border-color: var(--primary-light);
  background: var(--bg-card-hover);
}

.btn-full {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  margin-top: 16px;
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-add-food {
  background: var(--accent);
  color: var(--bg);
}

.btn-claim {
  background: var(--success);
  color: white;
  font-size: 12px;
  padding: 6px 12px;
}

/* Notifications */
.notif-section {
  position: relative;
}

.notif-bell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text);
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s;
}
.notif-bell:hover {
  border-color: var(--primary-light);
}

.notif-badge {
  background: var(--danger);
  color: white;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  padding: 0 6px;
}

.notif-drawer {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 12px 40px var(--shadow);
}

.notif-header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.notif-markread {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}

.notif-list {
  padding: 8px;
}

.notif-item {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.notif-item:hover {
  background: var(--bg-card-hover);
}

.notif-unread {
  background: rgba(124, 58, 237, 0.1);
}

.notif-text {
  font-size: 13px;
  flex: 1;
}

.notif-time {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* RIGHT PANEL */
.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: center;
}

.stat-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--primary-light);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.next-up-card .stat-value {
  font-size: 18px;
  color: var(--accent);
}

/* Calendar */
.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-month-label {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
}

.cal-nav-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.cal-nav-btn:hover {
  border-color: var(--primary-light);
  background: var(--bg-card-hover);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  gap: 2px;
}

.cal-cell:hover:not(.cal-empty):not(.cal-header) {
  background: var(--bg-card-hover);
}

.cal-header {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  cursor: default;
}

.cal-empty {
  cursor: default;
}

.cal-today {
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid var(--primary);
}

.cal-has-event {
  background: rgba(245, 158, 11, 0.15);
}

.cal-day-num {
  font-weight: 600;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Day Detail */
.day-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.day-detail-header {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--primary-light);
}

.day-event-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 6px;
}
.day-event-item:hover {
  background: var(--bg-card-hover);
}

.day-event-title {
  font-weight: 700;
  font-size: 14px;
}

.day-event-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* Events List */
.events-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.event-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.event-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.15);
}

.event-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.event-card-title {
  font-weight: 800;
  font-size: 15px;
}

.event-card-date {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

.event-card-bottom {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 24px;
  font-size: 14px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 24px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row .form-group {
  flex: 1;
}

/* Game Suggestions */
.game-input-wrap {
  position: relative;
}

.game-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  margin-top: 4px;
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px var(--shadow);
}

.game-suggestion-item {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.game-suggestion-item:hover {
  background: var(--bg-card-hover);
}

/* Player Picker */
.player-picker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-picker-empty {
  color: var(--text-dim);
  font-size: 13px;
}

.player-chip {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  color: var(--text);
}
.player-chip:hover {
  border-color: var(--primary-light);
}

.player-chip-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Food Toggle */
.food-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.food-toggle-label {
  font-weight: 700;
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border-radius: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 2px;
  left: 2px;
  transition: all 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
  border-color: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: white;
}

.food-section {
  margin-bottom: 12px;
}

.food-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.food-add-row .form-input {
  flex: 1;
}

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

.food-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  font-size: 13px;
}

.food-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}

/* RSVP Cards */
.rsvp-invite-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rsvp-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}

.rsvp-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.rsvp-card-title {
  font-weight: 800;
  font-size: 16px;
}

.rsvp-card-date {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.rsvp-card-location {
  font-size: 13px;
  color: var(--text-muted);
}

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

.btn-rsvp-yes,
.btn-rsvp-maybe,
.btn-rsvp-no {
  flex: 1;
  padding: 10px 8px;
  font-size: 13px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  transition: all 0.2s;
}

.btn-rsvp-yes:hover { border-color: var(--success); }
.btn-rsvp-maybe:hover { border-color: var(--maybe); }
.btn-rsvp-no:hover { border-color: var(--danger); }

.btn-rsvp-yes.rsvp-active {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.btn-rsvp-maybe.rsvp-active {
  background: var(--maybe);
  border-color: var(--maybe);
  color: var(--bg);
}
.btn-rsvp-no.rsvp-active {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Event Detail */
.event-detail-content {
  padding-top: 8px;
}

.event-detail-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 16px;
}

.event-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.event-detail-section {
  margin-bottom: 20px;
}

.event-detail-section-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}

.rsvp-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
}

.rsvp-count {
  font-size: 13px;
  font-weight: 700;
}

.rsvp-going { color: var(--success); }
.rsvp-maybe { color: var(--maybe); }

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

.rsvp-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  font-size: 13px;
}

.rsvp-detail-name {
  font-weight: 700;
}

.rsvp-detail-status {
  font-size: 12px;
}

.rsvp-status-yes { color: var(--success); }
.rsvp-status-maybe { color: var(--maybe); }
.rsvp-status-no { color: var(--danger); }

.invited-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.food-claim-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.food-claim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  font-size: 13px;
}

.food-claimed {
  border-left: 3px solid var(--success);
}

.food-claim-name {
  font-weight: 600;
}

.food-claim-by {
  color: var(--success);
  font-size: 12px;
  cursor: pointer;
}

.food-unclaim {
  color: var(--text-dim);
  font-size: 11px;
}

/* Responsive */
@media (max-width: 900px) {
  .app-wrapper {
    flex-direction: column;
    padding: 20px 16px;
  }
  .left-panel {
    width: 100%;
  }
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .next-up-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 500px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-direction: column;
  }
  .rsvp-actions {
    flex-direction: column;
  }
  .hero-title {
    font-size: 26px;
  }
}