/* ================================
   EVENTS PAGE STYLES
================================ */

/* Hero Section */
.events-hero {
  padding: 80px 20px;
  text-align: center;
  background: var(--bg-primary);
}

/* ================================
   Event List Layout
================================ */
.events-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Force 3 columns on desktop */
  gap: 70px 30px; /* Vertical gap 70px, horizontal gap 30px */
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 400px;
  isolation: isolate;
  align-items: start;
  grid-auto-rows: auto;
}

@media (max-width: 992px) {
  .events-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 70px 20px;
  }
}

@media (max-width: 600px) {
  .events-container {
    grid-template-columns: 1fr;
    gap: 40px 0;
  }
}

/* ================================
   Event Card
================================ */
.event-card {
  background: #ffffff;
  padding: 1.25rem 1.4rem;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border-left: 6px solid #3b82f6;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: visible;
  z-index: 1;
  margin-bottom: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.event-card:focus,
.event-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  outline: none;
  border-color: var(--accent-color);
  z-index: 10;
}

/* Status variations */
.event-card.upcoming {
  border-left-color: #3b82f6;
}

.event-card.today {
  border-left-color: #22c55e;
}

.event-card.ended {
  border-left-color: #9ca3af;
  opacity: 0.85;
}

/* ================================
   Header
================================ */
.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.event-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
  margin: 0;
}

.event-card h2 {
  margin: 0 0 10px 0;
  color: var(--text-primary);
  font-size: 1.4rem;
}

/* Status badge */
.event-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-status.upcoming {
  background: #e0edff;
  color: #1d4ed8;
}

.event-status.today {
  background: #dcfce7;
  color: #166534;
}

.event-status.ended {
  background: #f3f4f6;
  color: #374151;
}

/* ================================
   Meta Info
================================ */
.event-meta {
  display: grid;
  gap: 0.45rem;
  margin: 0.5rem 0 0.75rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.meta-item i {
  color: #6b7280;
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
}

.event-date,
.event-location {
  color: var(--text-secondary);
  margin: 5px 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-date i,
.event-location i {
  color: var(--accent-color);
  width: 20px;
  text-align: center;
}

/* ================================
   Description
================================ */
.event-description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #374151;
  margin: 0.75rem 0 1.2rem;
  flex-grow: 1;
  max-height: 100px;
  overflow-y: auto;
  padding-right: 10px;
  margin-right: -10px;
}

.event-description::-webkit-scrollbar {
  width: 6px;
}

.event-description::-webkit-scrollbar-thumb {
  background: rgba(100, 100, 100, 0.5);
  border-radius: 3px;
}

.event-description::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* ================================
   Event Footer (Register + Views)
================================ */
.event-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ================================
   Register Section
================================ */
.event-register {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.event-actions {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.btn-register {
  padding: 0.6rem 1.1rem;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
  position: relative;
  z-index: 15;
}

/* Active register button */
.btn-open-register {
  background: linear-gradient(135deg, #86b0f3, #4373d9);
  color: #ffffff;
}

.btn-open-register:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px) scale(1.05);
}

/* Disabled button */
.btn-register.disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.6;
  filter: grayscale(100%);
}

.btn-event {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  z-index: 15;
}

.btn-event:hover {
  background: var(--accent-color);
  color: white;
}

/* ================================
   View Counter
================================ */
.event-views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  color: #666;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  user-select: none;
}

.event-views:hover {
  transform: scale(1.05);
  color: #3b82f6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.view-icon {
  font-size: 1rem;
  line-height: 1;
}

.view-count {
  font-weight: 500;
  white-space: nowrap;
}

/* Pulse animation when count updates */
@keyframes viewPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.event-views.view-pulse {
  animation: viewPulse 0.5s ease;
}

@media (max-width: 768px) {
  .event-views {
    font-size: 0.75rem;
    padding: 3px 6px;
  }

  .view-icon {
    font-size: 0.875rem;
  }
}

/* ================================
   Empty / Error State
================================ */
.no-events {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: #f9fafb;
  border-radius: 14px;
  color: #374151;
}

.no-events h3 {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.no-events.error {
  background: #fff1f2;
  color: #7f1d1d;
}

/* ================================
   PAGINATION CONTROLS
================================ */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px auto 40px auto;
  gap: 15px;
}

.pagination-btn {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 600;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ================================
   COUNTDOWN SECTION
================================ */
#countdown-section.countdown-hidden {
  display: none !important;
}

#countdown-section {
  margin-top: 40px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  display: inline-block;
}

#countdown-section h3 {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#countdown-timer {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.time-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.time-unit span {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-color);
  line-height: 1;
}

.time-unit label {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 10px;
  font-weight: 600;
}

.time-unit:not(:last-child)::after {
  content: ':';
  position: absolute;
  right: -20px;
  top: 5px;
  font-size: 2rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

.countdown-note {
  margin-top: 8px;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* ================================
   ORGANIZE/HOST EVENT SECTION
================================ */
.organize-section {
  padding: 100px 20px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(59, 130, 246, 0.03) 100%);
  border-top: 1px solid var(--border-color);
  margin-top: 60px;
}

.organize-container {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

.organize-container:hover {
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.12);
}

.organize-content {
  padding: 50px;
}

.form-header {
  margin-bottom: 35px;
}

.form-header h2 {
  margin: 0 0 12px 0;
  font-size: 2.2rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
}

.form-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
}

.organize-content h2 {
  margin-top: 0;
  font-size: 2rem;
  color: var(--text-primary);
}

.organize-content p {
  color: var(--text-secondary);
  margin-bottom: 25px;
}

/* ================================
   FORM STRUCTURE
================================ */
.form-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 30px 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.required-indicator {
  color: #ef4444;
  font-weight: 700;
  margin-left: 4px;
}

/* ================================
   FORM INPUTS
================================ */
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: all 0.25s ease;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: rgba(59, 130, 246, 0.4);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: var(--card-bg);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* Select dropdown styling */
.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 45px;
}

/* Date input enhancement */
.form-group input[type='date'] {
  cursor: pointer;
  position: relative;
}

.form-group input[type='date']::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  filter: invert(1);
}

.form-group input[type='date']::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ================================
   HELPER TEXT & VALIDATION
================================ */
.field-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.char-counter {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.field-error {
  display: none;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #ef4444;
  font-weight: 500;
}

.form-group.error .field-error {
  display: block;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.form-group.error input:focus,
.form-group.error select:focus,
.form-group.error textarea:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-group.success input,
.form-group.success select,
.form-group.success textarea {
  border-color: #10b981;
}

/* ================================
   SUBMIT BUTTON
================================ */
.btn-organize {
  width: 100%;
  padding: 16px 28px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-organize::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn-organize:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.btn-organize:hover::before {
  left: 100%;
}

.btn-organize:active {
  transform: translateY(0);
}

.btn-organize:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon {
  transition: transform 0.3s ease;
}

.btn-organize:hover .btn-icon {
  transform: translateX(4px);
}

/* ================================
   FEEDBACK MESSAGE
================================ */
.feedback-message {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  display: none;
}

.feedback-message.show {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

.feedback-message.success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.feedback-message.error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ================================
   VISUAL SECTION
================================ */
.organize-visual {
  position: relative;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.organize-image {
  background: linear-gradient(135deg, var(--accent-color), #0088cc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 8rem;
  opacity: 0.9;
}

.organize-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: grayscale(20%);
}

.visual-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.9);
  font-size: 8rem;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-20px); }
}

/* ================================
   TOAST NOTIFICATION
================================ */
#toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(20, 20, 25, 0.9);
  color: #fff;
  padding: 12px 25px;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 10000;
  border: 1px solid var(--accent-color);
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================================
   BUTTON LOADING STATE
================================ */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotate 0.8s infinite linear;
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ================================
   DARK MODE - Event Cards
================================ */
body.dark-mode #events-container {
  background: transparent;
}

/* Card base */
body.dark-mode .event-card {
  background: #0f172a;
  color: #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
}

/* Hover / focus */
body.dark-mode .event-card:hover,
body.dark-mode .event-card:focus {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

/* Title */
body.dark-mode .event-title {
  color: #f9fafb;
}

/* Status badge */
body.dark-mode .event-status.upcoming {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

body.dark-mode .event-status.today {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

body.dark-mode .event-status.ended {
  background: rgba(156, 163, 175, 0.15);
  color: #d1d5db;
}

/* Meta info */
body.dark-mode .event-meta {
  color: #cbd5f5;
}

body.dark-mode .meta-item {
  color: #cbd5f5;
}

body.dark-mode .meta-item i {
  color: #94a3b8;
}

/* Description */
body.dark-mode .event-description {
  color: #d1d5db;
}

/* Register button */
body.dark-mode .btn-open-register {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #ffffff;
}

body.dark-mode .btn-open-register:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
}

/* Disabled button */
body.dark-mode .btn-register.disabled {
  background: #1f2933;
  color: #9ca3af;
}

/* Ended events slightly faded */
body.dark-mode .event-card.ended {
  opacity: 0.75;
}

/* Empty / error state */
body.dark-mode .no-events {
  background: #020617;
  color: #e5e7eb;
}

body.dark-mode .no-events.error {
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
}

/* ================================
   DARK MODE - Organize Section
================================ */
body.dark-mode .organize-section {
  background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(59, 130, 246, 0.05) 100%);
}

body.dark-mode .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

body.dark-mode .form-group input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

body.dark-mode .event-views {
  background: rgba(15, 23, 42, 0.9);
  color: #cbd5e1;
}

body.dark-mode .event-views:hover {
  color: #3b82f6;
}

/* ================================
   RESPONSIVE DESIGN
================================ */
@media (max-width: 992px) {
  .organize-container {
    grid-template-columns: 1fr;
  }

  .organize-visual {
    min-height: 250px;
    order: -1;
  }

  .organize-content {
    padding: 40px 35px;
  }
}

@media (max-width: 768px) {
  .organize-image {
    display: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  #countdown-timer {
    gap: 15px;
  }

  .time-unit span {
    font-size: 2rem;
  }

  .time-unit:not(:last-child)::after {
    right: -10px;
    font-size: 1.5rem;
  }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .organize-content {
    padding: 30px 25px;
  }

  .form-header h2 {
    font-size: 1.8rem;
  }

  .organize-section {
    padding: 60px 20px;
  }
}