:root {
  --primary: #800080;
  --bg-light: #F8F9FC;
    --text-dark: #1F2937;
    --text-muted: #FF7A00;
    --white: #ffffff;
  
  /* Helper Tokens */
  --primary-hover: #380038;
  --border-color: #380038;
  --shadow-sm: 0 4px 12px rgba(35, 31, 32, 0.05);
  --shadow-lg: 0 12px 28px rgba(91, 26, 45, 0.15);
  --radius: 12px;
  --transition: all 0.25s ease;
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
}

/* Base Hidden Helper */
.hidden {
  display: none !important;
}

/* ==========================================
   1. Navbar Styles
   ========================================== */
.navbar {
  background-color: var(--bg-light);
  color: var(--text-dark);
  padding: 14px 0;
  box-shadow: 0 4px 14px rgba(91, 26, 45, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo>img {
  width: 120px;
  height: auto;
}

.logo:hover {
  opacity: 0.9;
}

.nav-auth-container {
  display: flex;
  align-items: center;
}

/* User Menu Component */
.user-menu-container {
  position: relative;
  display: inline-block;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--text-light);
  border: 2px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 30px;
  cursor: pointer;
  color: var(--text-dark);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.user-profile-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--white);
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 250px;
  background: var(--white);
  color: var(--text-dark);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 8px 0;
  z-index: 1010;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dropdown-header strong {
  display: block;
  color: var(--primary);
  font-weight: 700;
  word-break: break-all;
}

.user-dropdown hr {
  margin: 6px 0;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-dark);
  background: none;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  transition: var(--transition);
}

.dropdown-item i {
  color: var(--primary);
  width: 16px;
  text-align: center;
}

.dropdown-item:hover {
  background: var(--bg-light);
  color: var(--primary);
}

.dropdown-item.logout-btn {
  color: #d93838;
}

.dropdown-item.logout-btn i {
  color: #d93838;
}

.dropdown-item.logout-btn:hover {
  background: #fff5f5;
  color: #d93838;
}

/* ==========================================
   2. Dashboard Layout & Cards
   ========================================== */
.dashboard-container {
  max-width: 1600px;
  margin: 40px auto;
  padding: 0 24px;
  min-height: 75vh;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 20px;
}

.dashboard-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}

.dashboard-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.event-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.event-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0.85;
}

.event-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(91, 26, 45, 0.25);
}

.event-card-header {
  margin-bottom: 12px;
}

.event-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  line-height: 1.3;
}

.event-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 18px 0;
}

.event-meta span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-meta i {
  color: var(--primary);
  width: 16px;
  text-align: center;
}

.event-desc {
  font-size: 0.925rem;
  color: var(--text-dark);
  line-height: 1.6;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.event-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 16px;
}

.btn-delete {
  background: transparent;
  color: #d93838;
  border: 1px solid rgba(217, 56, 56, 0.3);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-delete:hover {
  background: #d93838;
  color: var(--white);
  border-color: #d93838;
}

/* Primary Button */
.btn-primary {
  background: var(--primary);
  color: var(--white);
  padding: 12px 22px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(91, 26, 45, 0.25);
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 26, 45, 0.35);
}

/* Empty & Loading States */
.empty-state, .loading-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--white);
  border-radius: var(--radius);
  border: 2px dashed var(--border-color);
  grid-column: 1 / -1;
  box-shadow: var(--shadow-sm);
}

.empty-state h3 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin: 12px 0 6px 0;
}

.empty-state p, .loading-state p {
  color: var(--text-muted);
  margin: 0;
}

.empty-icon, .spinner {
  color: var(--primary);
}

.empty-icon {
  opacity: 0.6;
}

/* ==========================================
   3. Responsive Media Queries
   ========================================== */
@media (max-width: 768px) {
  .dashboard-container {
    margin: 24px auto;
    padding: 0 16px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
  }

  .dashboard-header h1 {
    font-size: 1.6rem;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .events-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .user-name {
    display: none; /* Hide username text on smaller screens to keep navbar clean */
  }

  .user-profile-btn {
    padding: 4px 8px;
    gap: 6px;
  }

  .user-dropdown {
    right: -10px;
    width: 200px;
  }
}

@media (max-width: 480px) {
  .nav-container {
    padding: 0 16px;
  }

  .logo {
    font-size: 1.3rem;
  }

  .event-card {
    padding: 18px;
  }
}

/* ==========================================
   Modal & Form Styles
   ========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(35, 31, 32, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  box-sizing: border-box;
}

.modal-container {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  animation: modalSlideUp 0.25s ease-out;
}

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

.modal-header {
  padding: 20px 24px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--primary);
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: var(--primary);
}

.modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-dark);
  background: var(--white);
  box-sizing: border-box;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 26, 45, 0.12);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-light);
  color: var(--text-dark);
}

.btn-edit {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-edit:hover {
  background: var(--primary);
  color: var(--white);
}

/* Toast Notification Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: calc(100% - 48px);
  pointer-events: none;
}

/* Base Toast Card */
.toast {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.92rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* Toast Body Layout */
.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  padding-right: 8px;
}

.toast-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.toast-message {
  line-height: 1.4;
  word-break: break-word;
}

/* Close Button */
.toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.toast-close:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.15);
}

/* Color Variants */
.toast-success { background-color: #10b981; }
.toast-error   { background-color: #ef4444; }
.toast-info    { background-color: #3b82f6; }
.toast-warning { background-color: #f59e0b; }

/* Dynamic Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.35);
  transform-origin: left;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: #ffffff;
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

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

.btn-danger {
  background-color: #dc2626;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-secondary {
  background-color: #f3f4f6;
  color: #374151;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}