:root {
  --primary-color: #6366f1;
  --secondary-color: #8b5cf6;
  --gold-color: #fbbf24;
  --danger-color: #ef4444;
  --success-color: #10b981;
  --background: #f9fafb;
  --surface: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* Onboarding */
.onboarding-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.onboarding-slide {
  display: none;
  animation: fadeIn 0.5s;
}

.onboarding-slide.active {
  display: block;
}

.onboarding-image {
  width: 100%;
  max-width: 300px;
  margin: 2rem auto;
}

.onboarding-slide h1,
.onboarding-slide h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.onboarding-slide p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Auth Screen */
.auth-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem;
}

.auth-container h1 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 2rem;
}

.auth-form {
  display: none;
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s;
}

.auth-form h2 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-form input,
.auth-form textarea,
.auth-form select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

.auth-form textarea {
  min-height: 80px;
  resize: vertical;
}

.subscription-choice {
  margin: 1.5rem 0;
}

.subscription-choice h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.radio-card {
  display: block;
  margin-bottom: 1rem;
  cursor: pointer;
}

.radio-card input[type="radio"] {
  display: none;
}

.radio-card .card-content {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s;
}

.radio-card input[type="radio"]:checked + .card-content {
  border-color: var(--primary-color);
  background-color: rgba(99, 102, 241, 0.05);
}

.radio-card.gold input[type="radio"]:checked + .card-content {
  border-color: var(--gold-color);
  background-color: rgba(251, 191, 36, 0.05);
}

.radio-card h4 {
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.radio-card.gold h4 {
  color: var(--gold-color);
}

.radio-card ul {
  list-style: none;
  padding-left: 0;
}

.radio-card li {
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.radio-card li:before {
  content: "✓ ";
  color: var(--success-color);
  font-weight: bold;
}

.checkbox-group {
  margin: 1rem 0;
}

.checkbox-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
}

.auth-form p {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-secondary);
}

.auth-form a {
  color: var(--primary-color);
  text-decoration: none;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-gold,
.btn-danger {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #4f46e5;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--background);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-color), #f59e0b);
  color: white;
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.icon-btn:hover {
  background-color: var(--background);
}

/* App Screen */
#app-screen {
  padding-bottom: 70px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem 1rem;
  position: relative;
  transition: color 0.3s;
}

.nav-item.active {
  color: var(--primary-color);
}

.nav-item .icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.nav-item span:not(.icon):not(.badge) {
  font-size: 0.75rem;
}

.badge {
  position: absolute;
  top: 0.25rem;
  right: 0.5rem;
  background-color: var(--danger-color);
  color: white;
  border-radius: 10px;
  padding: 0.125rem 0.375rem;
  font-size: 0.7rem;
  font-weight: bold;
}

/* App Sections */
.app-section {
  display: none;
}

.app-section.active {
  display: block;
  animation: fadeIn 0.3s;
}

/* Home Section */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem;
  border-radius: 12px;
  margin: 1rem;
}

.welcome-banner h2 {
  margin-bottom: 0.5rem;
}

.quick-filters {
  padding: 1rem;
}

.quick-filters h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.chip {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.chip.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.suggested-events {
  padding: 1rem;
}

.suggested-events h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Events Section */
.search-bar {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
}

.search-bar input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

.filters-panel {
  display: none;
  padding: 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}

.filters-panel.active {
  display: block;
  animation: slideDown 0.3s;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.events-list {
  padding: 1rem;
}

.event-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
}

.event-card h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.event-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--background);
  border-radius: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.event-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.event-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.event-participants {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.participants-avatars {
  display: flex;
  margin-left: 0.5rem;
}

.participant-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  margin-left: -10px;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.participant-avatar:first-child {
  margin-left: 0;
}

/* Chat Section */
.chat-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.chat-list {
  padding: 1rem;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.chat-item:hover {
  background-color: var(--background);
}

.chat-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.chat-info {
  flex: 1;
  min-width: 0;
}

.chat-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.chat-last-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.chat-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.chat-unread {
  background-color: var(--primary-color);
  color: white;
  border-radius: 10px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: bold;
}

/* Profile Section */
.profile-card {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem;
  text-align: center;
  margin: 1rem;
  border-radius: 12px;
}

.profile-avatar {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid white;
  object-fit: cover;
}

.edit-avatar-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 2px solid white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subscription-badge {
  display: inline-block;
  padding: 0.25rem 1rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.subscription-badge.gold {
  background-color: var(--gold-color);
  color: var(--text-primary);
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.profile-info {
  padding: 1rem;
  background: var(--surface);
  margin: 1rem;
  border-radius: 12px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
}

.info-item label {
  font-weight: 600;
  color: var(--text-secondary);
}

.profile-actions {
  padding: 1rem;
}

/* Admin Panel */
.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.admin-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border-color);
}

.admin-tab {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}

.admin-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.admin-content {
  padding: 1rem;
}

.admin-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.admin-card h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.admin-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.admin-actions button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1999;
}

.modal-overlay.active {
  display: block;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
}

.modal.active {
  display: block;
  animation: modalSlideIn 0.3s;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  color: var(--primary-color);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 1rem;
}

/* Chat Modal */
.chat-modal {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.chat-body {
  display: flex;
  flex-direction: column;
  height: 60vh;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.5rem;
  max-width: 70%;
}

.message.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
  flex-shrink: 0;
}

.message-content {
  background-color: var(--background);
  padding: 0.75rem;
  border-radius: 12px;
}

.message.own .message-content {
  background-color: var(--primary-color);
  color: white;
}

.message-text {
  margin-bottom: 0.25rem;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.chat-input-container input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .events-grid {
    grid-template-columns: 1fr;
  }
  
  .modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .filter-chips {
    -webkit-overflow-scrolling: touch;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}
/* Force modals to be hidden by default */
.modal {
  display: none !important;
}

.modal.active {
  display: block !important;
}

.modal-overlay {
  display: none !important;
}

.modal-overlay.active {
  display: block !important;
}
/* Prevent modal from opening when clicking admin buttons */
.btn-primary, .btn-secondary, .admin-tab {
  position: relative;
  z-index: 10;
}

/* Admin screen should be above everything */
#admin-screen {
  position: relative;
  z-index: 50;
}

/* Ensure modals don't interfere */
.modal-overlay {
  z-index: 1999;
}

.modal {
  z-index: 2000;
}