/* Base styles */
body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #fdfdfd;
  color: #333;
}

header {
  background-color: #f4f0e8;
  padding: 1rem 2rem;
  border-bottom: 2px solid #ccc;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  color: #5a3e2b;
}

nav {
  margin-top: 1rem;
}

nav button {
  margin: 0 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #e0d6c6;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s ease;
}

nav button:hover {
  background-color: #d4c6b4;
}

* {
  box-sizing: border-box;
}

/* View sections */
.view-section {
  padding: 2rem;
}

#events-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
  justify-content: center;
}

.event-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 1rem;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  transition: width 0.5s ease, height 0.5s ease, box-shadow 0.3s ease, padding 0.3s ease, transform 0.5s;
  overflow: hidden;
  position: relative;
  width: 70%;
  max-width: 900px;
  outline: none;
}

.event-description {
  flex: 1;
  line-height: 1.5;
  background-color: rgba(255, 255, 255, 0.65);
  padding: 1rem;
  border-radius: 8px;
  position: relative;
  z-index: 2;
  min-width: 300px;
  max-width: 100%;
}

/* Calendar placeholder */
#calendar-container {
  font-size: 1.2rem;
  color: #777;
  text-align: center;
  padding: 2rem;
  background-color: #f9f9f9;
  border-radius: 8px;
}

/* Create Event Form */
#event-form h2 {
  color: #5a3e2b;
  margin-bottom: 1rem;
}

#create-event-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

#create-event-form label {
  display: flex;
  flex-direction: column;
  font-weight: bold;
  color: #444;
}

#create-event-form input,
#create-event-form textarea {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

#create-event-form button {
  padding: 0.6rem 1rem;
  background-color: #c2b59b;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#create-event-form button:hover {
  background-color: #b3a58d;
}

.event-card::before {
  content: "";
  border: 1px solid #c2b59b;
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: 0 0 0 0 #a0d2eb;
  animation: pulseOutline 0.6s ease forwards;
}

.event-card:hover {
  box-shadow: 0 0 0 2px #c2b59b;
  transform: scale(1.02);
}

.event-card:focus {
  box-shadow: 0 0 0 2px #a3b18a;
}

.event-preview {
  position: relative;
  z-index: 1;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 1rem;
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
  width: 100%;
  flex: 0 0 auto;
}

.event-preview::after {
  content: "";
  display: block;
  height: 1px;
  background-color: #ddd;
  margin-top: 1rem;
}

.event-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.event-address,
.event-datetime {
  font-size: 0.95rem;
  color: #555;
}

/* Expanded card layout */
.event-details {
  display: none;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  padding: 1rem;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.event-card.expanded {
  width: 70%;              /* smaller size */
  max-width: 900px;
  height: auto;
  flex-direction: row;      /* two-column layout */
  align-items: flex-start;
  transform: translateY(-10px) translateX(-10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  gap: 2rem;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.event-card.expanded .event-content {
  flex: 1;
  max-width: 40%;
}

.event-card.expanded .event-details {
  flex: 2;
  opacity: 1;
  margin-top: 0.5rem;
  transform: none;
  display: flex;
}
.event-map {
  width: 100%;
  height: 750px;
  position: absolute;
  inset: 0;
  z-index: 0;
}
.event-card.map-view .event-map {
  position: absolute;
  inset: 0;
  height: 100%;
}
.event-card.map-view .foreground {
  opacity: 0;
  pointer-events: none;
}
.foreground {
  position: relative;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Map view toggle */
.event-card.map-view .event-content,
.event-card.map-view .event-description,
.event-card.map-view .event-photo-container {
  opacity: 0;
  pointer-events: none;
}

.event-card.map-view .view-map-button {
  opacity: 1;
  pointer-events: auto;
  z-index: 4;
}

.event-photo-container {
  flex: 0 0 auto;
  max-width: 400px;
}

.event-photo {
  width: 100%;
  height: auto;
  border-radius: 6px;
  object-fit: cover;
  opacity: 0.9;
}

.view-map-button {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  padding: 0.4rem 0.8rem;
  background-color: #c2b59b;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 999;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}

.view-map-button:hover {
  background-color: #b3a58d;
}

.full-map-container {
  display: none;
  max-width: 400px;
  width: 100%;
  margin-top: 1rem;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.full-map-image {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.event-card:not(.expanded) {
  max-height: 220px;
}

/* Overlay for readability */
.event-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.65);
  transition: opacity 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.event-card.map-view::after {
  opacity: 0;
}
