/* ==========================================================================
   Portal Specific Styles (Premium Tarot Card Layout & High-End Typography)
   ========================================================================== */

.portal-container {
  max-width: 1600px;
  width: 92%;
  margin: 0 auto;
  padding: var(--space-3xl) 0 var(--space-3xl) 0;
}

/* Sections */
.section-title-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2xl);
  gap: var(--space-md);
  text-align: center;
}

.section-title-wrapper.align-left {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  margin-bottom: var(--space-xl);
}

.section-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
}

.section-title.align-left {
  justify-content: flex-start;
  text-align: left;
}

.section-title::after {
  content: '♦';
  font-size: 0.9rem;
  color: var(--accent-primary);
  display: inline-block;
  margin-left: 2px;
  text-shadow: var(--glow-primary);
}

/* Portrait Tarot Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-3xl);
  justify-content: center;
}

/* Premium Tarot Card (Long screen proportions) */
.portal-card {
  position: relative;
  background: #0D1117;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 68vh; /* Proportionate to 16:9 screen height */
  min-height: 560px;
  max-height: 750px;
  box-shadow: var(--shadow-premium);
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

/* Inset Ornate Frame (Tarot Card Border Overlay) */
.portal-card::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  pointer-events: none;
  z-index: 3;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.portal-card:hover {
  transform: translateY(-10px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-premium), var(--glow-primary);
}

.portal-card:hover::after {
  border-color: rgba(102, 252, 241, 0.35); /* Glowing inner border */
  box-shadow: inset 0 0 15px rgba(102, 252, 241, 0.1);
}

.card-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  color: inherit;
  text-decoration: none;
}

.card-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: #0B0D10;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.65) contrast(1.15) saturate(0.85); /* Darker, mysterious tarot look by default */
  transition: transform var(--transition-normal), filter var(--transition-normal);
}

.portal-card:hover .card-image-wrapper img {
  transform: scale(1.05);
  filter: brightness(0.85) contrast(1.05) saturate(1); /* Brightens up on hover */
}

.card-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #11151A 0%, #06080A 100%);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-family: var(--font-body);
}

/* Glass gradient text overlay (centered at bottom) */
.card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 45%;
  background: linear-gradient(to top, rgba(11, 12, 16, 0.98) 0%, rgba(11, 12, 16, 0.85) 60%, transparent 100%);
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
  transition: height var(--transition-normal);
}

.card-text-wrapper {
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--space-xs);
}

.card-content h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
  margin: 0;
  color: #fff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: var(--space-sm);
  transition: border-color var(--transition-normal);
}

.portal-card:hover h3 {
  border-color: rgba(102, 252, 241, 0.25); /* Cyan separator on hover */
}

.card-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  max-height: 0;
  opacity: 0;
  transition: max-height var(--transition-normal), opacity var(--transition-normal), margin-top var(--transition-normal);
  text-align: center;
  font-family: var(--font-body);
}

/* Expand text content overlays and slide up descriptions on hover */
.portal-card:hover .card-content {
  height: 68%; /* Pulls content higher to read description */
}

.portal-card:hover .card-description {
  max-height: 180px;
  opacity: 1;
  margin-top: var(--space-md);
}

/* Dashed Add-Card Placeholder in Admin Mode */
.add-card-placeholder {
  background: rgba(102, 252, 241, 0.01);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 68vh; /* Proportional to cards */
  min-height: 560px;
  max-height: 750px;
  border-radius: var(--radius-lg);
  position: relative;
  transition: all var(--transition-fast);
}

.add-card-placeholder::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  bottom: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.add-card-placeholder:hover {
  background: rgba(102, 252, 241, 0.02);
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

.add-card-placeholder:hover::after {
  border-color: rgba(102, 252, 241, 0.2);
}

.add-card-inner {
  text-align: center;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  z-index: 2;
}

.add-card-placeholder:hover .add-card-inner {
  color: var(--accent-primary);
}

.add-card-inner svg {
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-sm);
  fill: currentColor;
}

.add-card-inner h3 {
  font-family: 'Lora', Georgia, serif;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Calendar & Events Section Layout */
.calendar-events-section {
  display: grid;
  grid-template-columns: 1.25fr 1.75fr;
  gap: var(--space-3xl);
  align-items: start;
}

/* Calendar Card */
.calendar-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-premium);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.calendar-header h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}

.calendar-nav-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.calendar-nav-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

.calendar-nav-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.calendar-weekday {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-xs) 0;
  font-family: var(--font-body);
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  color: var(--text-color);
}

.calendar-day:hover:not(.empty-day) {
  background-color: var(--glass-hover);
  border-color: var(--glass-border);
}

.empty-day {
  cursor: default;
}

.current-day {
  border-color: var(--accent-primary);
  font-weight: 700;
  color: var(--accent-primary);
}

.calendar-day.selected-day {
  background: var(--accent-primary) !important;
  color: #0B0C10 !important;
  font-weight: 700;
  box-shadow: var(--glow-primary);
}

/* Calendar Event Dot */
.event-indicator-container {
  display: flex;
  justify-content: center;
  position: absolute;
  bottom: 6px;
  width: 100%;
}

.event-dot {
  width: 5px;
  height: 5px;
  background-color: var(--accent-primary);
  border-radius: var(--radius-full);
  box-shadow: var(--glow-primary);
}

.calendar-day.selected-day .event-dot {
  background-color: #0B0C10 !important;
  box-shadow: none;
}

/* Event List Styling */
.events-list-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.event-item {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-premium);
  position: relative;
}

.event-item:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-premium), var(--glow-primary);
}

.event-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xs);
  gap: var(--space-md);
}

.event-title-block h4 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-color);
  letter-spacing: -0.01em;
}

.event-time-place {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: 2px;
}

.event-time-place span.relative-time {
  color: var(--accent-primary);
  font-weight: 600;
}

.event-description {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.no-events-message {
  text-align: center;
  padding: var(--space-3xl);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   Floating Glassmorphic Admin Pill (Subtle bottom utility)
   ========================================================================== */

.admin-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 22, 28, 0.8);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-premium), var(--glow-secondary);
  border-radius: var(--radius-full);
  padding: 6px 12px 6px 20px;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  z-index: 1000;
  animation: adminPillSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes adminPillSlideIn {
  from {
    transform: translateX(-50%) translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.admin-pill-status {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
}

/* Pulse green indicator dot */
.admin-pill-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background-color: #39FF14;
  border-radius: var(--radius-full);
  display: inline-block;
  box-shadow: 0 0 8px #39FF14;
  animation: pulseActiveDot 2s infinite;
}

@keyframes pulseActiveDot {
  0% {
    box-shadow: 0 0 4px #39FF14;
    transform: scale(0.9);
  }
  50% {
    box-shadow: 0 0 12px #39FF14;
    transform: scale(1.1);
  }
  100% {
    box-shadow: 0 0 4px #39FF14;
    transform: scale(0.9);
  }
}

.admin-pill-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.admin-pill-btn:hover {
  background: var(--glass-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

.admin-pill-btn.logout {
  background: rgba(192, 92, 92, 0.2);
  border-color: rgba(192, 92, 92, 0.4);
  color: #FF8A8A;
}

.admin-pill-btn.logout:hover {
  background: rgba(192, 92, 92, 0.4);
  border-color: #FF8A8A;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 138, 138, 0.3);
}

/* Floating Edit / Delete Controls over cards */
.live-edit-overlay {
  position: absolute;
  top: 22px; /* Offset to clear inner frame */
  right: 22px;
  display: flex;
  gap: var(--space-xs);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

body.admin-mode .live-edit-overlay {
  opacity: 1;
  pointer-events: auto;
}

.overlay-action-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: #fff;
  backdrop-filter: blur(4px);
}

.overlay-action-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.overlay-edit-btn {
  background: rgba(155, 108, 255, 0.8);
}
.overlay-edit-btn:hover {
  background: var(--accent-secondary);
  box-shadow: var(--glow-secondary);
  transform: scale(1.05);
}

.overlay-delete-btn {
  background: rgba(192, 92, 92, 0.8);
}
.overlay-delete-btn:hover {
  background: #C05C5C;
  box-shadow: 0 0 10px rgba(192, 92, 92, 0.4);
  transform: scale(1.05);
}

/* Card Lock Badge (Top-Left corner for password protected modules) */
.card-lock-badge {
  position: absolute;
  top: 25px;
  left: 25px;
  width: 36px;
  height: 36px;
  background: rgba(13, 17, 23, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none; /* Clicks pass through to the link */
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card-lock-badge svg {
  width: 16px;
  height: 16px;
  fill: var(--accent-primary);
  filter: drop-shadow(var(--glow-primary));
}

.portal-card:hover .card-lock-badge {
  border-color: rgba(102, 252, 241, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), var(--glow-primary);
}

/* ==========================================================================
   Responsive Adaptations (Desktop-First)
   ========================================================================== */

@media (max-width: 1024px) {
  .calendar-events-section {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
}

@media (max-width: 768px) {
  .modules-grid {
    grid-template-columns: 1fr;
  }
  
  .portal-card {
    height: 480px;
  }
  
  .admin-pill {
    width: 90%;
    justify-content: space-between;
    padding: 6px 12px 6px 16px;
  }
}
