/**
 * Spontydex Theme - Centralized CSS
 * 
 * This file contains all theme variables and base styles for Spontydex web pages.
 * Matches the mobile app's dark theme with teal accents EXACTLY.
 * 
 * Import this file in all HTML pages:
 * <link rel="stylesheet" href="/styles/theme.css">
 */

/* ===== CSS Variables - EXACT MATCH TO MOBILE APP ===== */
:root {
  /* Primary Colors - from paperTheme.ts */
  --color-primary: #2DD4BF;
  --color-primary-container: #0D9488;
  --color-primary-dark: #14B8A6;
  
  /* Secondary/Accent Colors */
  --color-secondary: #4ADE80;
  --color-tertiary: #818cf8;
  --color-error: #ef4444;
  --color-warning: #FBBF24;
  
  /* Text Colors - from uiColors */
  --color-text-primary: #F7F9FA;
  --color-text-secondary: #9ca3af;
  --color-text-muted: #6b7280;
  --color-text-on-dark: #000000;
  --color-text-on-light: #ffffff;
  
  /* Background Colors - from uiColors */
  --color-bg-dark: #000000;
  --color-bg-card: #121212;
  --color-bg-subtle: #1f2937;
  --color-bg-surface-variant: #1f2937;
  --color-bg-overlay: rgba(0, 0, 0, 0.5);
  --color-bg-elevated: rgba(255, 255, 255, 0.03);
  
  /* Border Colors */
  --color-border-default: #374151;
  --color-border-subtle: #1f2937;
  --color-border-accent: rgba(45, 212, 191, 0.3);
  
  /* Status Colors - from statusColors */
  --color-status-host: #4ADE80;
  --color-status-approved: #2DD4BF;
  --color-status-pending: #9CA3AF;
  --color-status-rejected: #ef4444;
  
  /* Gradients - EXACT MATCH to gradients.background from paperTheme.ts */
  /* Original: ['#000000', '#080808', '#081010', '#051916', '#062320'] */
  --gradient-background: linear-gradient(180deg, 
    #000000 0%, 
    #080808 30%, 
    #081010 50%, 
    #051916 80%, 
    #062320 100%
  );
  
  /* Login gradient */
  --gradient-login: linear-gradient(180deg, 
    #000000 0%, 
    #080808 30%, 
    #081010 50%, 
    #062320 80%, 
    #073530 100%
  );
  
  --gradient-header: linear-gradient(135deg, #0D9488 0%, #2DD4BF 100%);
  --gradient-card: linear-gradient(180deg, rgba(45, 212, 191, 0.05) 0%, rgba(0, 0, 0, 0) 100%);
  
  /* Spacing - matches app spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* Border Radius - matches theme.roundness = 12 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Courier New', monospace;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--gradient-background);
  min-height: 100vh;
  color: var(--color-text-primary);
  line-height: 1.6;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* ===== App-style Container ===== */
.app-container {
  max-width: 500px;
  margin: 0 auto;
  padding: var(--spacing-md);
  min-height: 100vh;
}

/* ===== Card Component - matches app surface ===== */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--spacing-md);
}

.card-content {
  padding: var(--spacing-lg);
}

/* ===== App Header - matches app header style ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg) var(--spacing-md);
  position: relative;
}

.header-back {
  position: absolute;
  left: var(--spacing-md);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  cursor: pointer;
  border: none;
  font-size: 20px;
  transition: background 0.2s ease;
}

.header-back:hover {
  background: var(--color-bg-subtle);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

/* ===== Info Row - matches app infoRow style ===== */
.info-row {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
}

.info-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: var(--color-primary);
  font-size: 20px;
  flex-shrink: 0;
  padding-top: 2px;
}

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

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

.info-value {
  font-size: 16px;
  color: var(--color-text-primary);
  font-weight: 500;
}

.info-subtext {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ===== Host Item - matches app hostItem style ===== */
.host-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  cursor: default;
}

.host-avatar-container {
  position: relative;
  width: 36px;
  height: 36px;
}

.host-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
}

.host-crown-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--color-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  z-index: 1;
}

.host-text-container {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-xs);
  flex: 1;
  min-width: 0;
}

.host-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creator-text {
  font-size: 12px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--color-border-subtle);
  margin: var(--spacing-md) 0;
}

/* ===== Button Component - matches app buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  width: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-on-dark);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-on-dark);
}

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

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

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover {
  background: rgba(45, 212, 191, 0.1);
}

.btn-text {
  background: transparent;
  color: var(--color-primary);
  padding: var(--spacing-sm) var(--spacing-md);
}

.btn-text:hover {
  background: rgba(45, 212, 191, 0.1);
  transform: none;
}

/* ===== Badge/Chip Component ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-text-on-dark);
}

.badge-secondary {
  background: rgba(45, 212, 191, 0.1);
  color: var(--color-primary);
}

.badge-host {
  background: var(--color-secondary);
  color: var(--color-text-on-dark);
}

.badge-approved {
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
}

/* ===== Chip Component - matches app Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  background: rgba(45, 212, 191, 0.1);
  color: var(--color-primary);
  margin-right: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.categories {
  display: flex;
  flex-wrap: wrap;
}

/* ===== Attendees Avatars - matches app avatarGroup ===== */
.attendees-section {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.avatar-group {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: var(--spacing-sm);
  margin: calc(-1 * var(--spacing-sm));
  border-radius: var(--radius-md);
  transition: background 0.2s ease;
}

.avatar-group:hover {
  background: rgba(255, 255, 255, 0.05);
}

.attendee-avatar-container {
  position: relative;
  margin-left: -12px;
}

.attendee-avatar-container:first-child {
  margin-left: 0;
}

.attendee-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--color-bg-card);
  object-fit: cover;
  background: var(--color-bg-subtle);
}

.attendee-avatar.host {
  border-color: var(--color-primary);
}

.attendee-crown-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--color-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  z-index: 1;
}

.more-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-on-dark);
  border: 3px solid var(--color-bg-card);
  margin-left: -12px;
}

/* ===== ID Container - matches app idContainer ===== */
.id-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--color-bg-surface-variant);
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  margin: var(--spacing-md) 0;
  position: relative;
  overflow: hidden;
}

.id-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-primary);
}

.id-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin-left: var(--spacing-sm);
}

.id-text {
  flex: 1;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--color-text-primary);
  word-break: break-all;
}

.copy-icon {
  color: var(--color-primary);
  cursor: pointer;
  padding: var(--spacing-xs);
}

/* ===== Code Section ===== */
.code-section {
  text-align: center;
  padding: var(--spacing-md);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-md);
}

.code-label {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: var(--spacing-md);
}

.code {
  background: var(--color-bg-card);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  word-break: break-all;
  border: 1px solid var(--color-border-subtle);
}

/* ===== Download Buttons Grid ===== */
.download-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

/* ===== Landing Header ===== */
.landing-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg) var(--spacing-md);
}

.landing-header .logo {
  font-size: 20px;
}

/* ===== Bottom CTA - Clean Fixed Buttons ===== */
.bottom-cta {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border-subtle);
}

.btn-cta {
  flex: 1;
  padding: var(--spacing-md);
  font-size: 15px;
  font-weight: 600;
}

/* ===== Modal Styles ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--spacing-lg);
}

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

.modal-content {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-subtle);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border-subtle);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-bg-subtle);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 20px;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: var(--color-border-default);
}

.modal-body {
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
}

/* ===== Attendee List Item ===== */
.attendee-item {
  display: flex;
  align-items: center;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  transition: background 0.2s ease;
}

.attendee-item:hover {
  background: var(--color-bg-subtle);
}

.attendee-list-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: var(--spacing-md);
  border: 2px solid transparent;
}

.attendee-list-avatar.host-border {
  border-color: var(--color-primary);
}

.attendee-info {
  flex: 1;
}

.attendee-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.attendee-username {
  font-size: 14px;
  color: var(--color-text-muted);
}

.status-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.host-status {
  background: var(--color-secondary);
  color: var(--color-text-on-dark);
}

.approved-status {
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
}

.empty-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-muted);
}

/* ===== Full Text ===== */
.full-text {
  color: var(--color-error) !important;
  font-weight: 600;
}

/* ===== Page Header for Legal Pages ===== */
.page-header {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
  border-bottom: 1px solid var(--color-border-accent);
  margin-bottom: var(--spacing-lg);
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--spacing-sm);
}

.logo:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.page-subtitle {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.last-updated {
  color: var(--color-text-muted);
  font-size: 12px;
  margin-top: var(--spacing-sm);
}

/* ===== Section Headers for Legal Pages ===== */
.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-primary);
  margin: var(--spacing-xl) 0 var(--spacing-md);
}

.section-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: var(--spacing-lg) 0 var(--spacing-md);
}

/* ===== List Styles ===== */
ul, ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

li {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-sm);
}

/* ===== Alert/Box Components ===== */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  margin: var(--spacing-md) 0;
}

.alert-info {
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--color-border-accent);
}

.alert-title {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

/* ===== Footer ===== */
.page-footer {
  text-align: center;
  margin-top: var(--spacing-2xl);
  padding: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  font-size: 14px;
}

.page-footer a {
  color: var(--color-text-secondary);
  margin: 0 var(--spacing-sm);
}

.page-footer a:hover {
  color: var(--color-primary);
}

/* ===== Contact Box ===== */
.contact-box {
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-xl);
}

.contact-box h3 {
  color: var(--color-primary);
  margin-top: 0;
  margin-bottom: var(--spacing-md);
}

/* ===== Error Pages ===== */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-xl);
  text-align: center;
}

.error-emoji {
  font-size: 64px;
  margin-bottom: var(--spacing-lg);
}

.error-title {
  font-size: 24px;
  margin-bottom: var(--spacing-md);
}

.error-message {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
}

.error-detail {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-container {
    padding: var(--spacing-sm);
  }
  
  h1, .page-title { font-size: 24px; }
  h2, .section-title { font-size: 18px; }
  
  .modal-content {
    max-height: 90vh;
    margin: var(--spacing-sm);
  }
  
  .attendee-avatar {
    width: 36px;
    height: 36px;
  }
  
  .more-avatar {
    width: 36px;
    height: 36px;
    font-size: 11px;
  }
}
