dialog {
  width: min(540px, calc(100vw - 28px));
  padding: 0;
  border: var(--border-width) solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.modal-header {
  min-height: 66px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-width) solid var(--line);
  background: var(--paper);
}

.modal-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: var(--border-width) solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
}

.close-btn:hover {
  background: var(--bar-bg);
}

.modal-events {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-event {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 16px;
  border-bottom: var(--border-thin) solid var(--line);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  transition: background 0.1s ease;
}

.modal-event:last-child {
  border-bottom: 0;
}

/* Category Backgrounds inside Modal */
.modal-event.ctf { background: var(--ctf); }
.modal-event.hackathon { background: var(--hackathon); }
.modal-event.datathon { background: var(--datathon); }
.modal-event.cp { background: var(--cp); }
.modal-event.business-case { background: var(--business-case); }
.modal-event.fest { background: var(--fest); }
.modal-event.other { background: var(--other); }

.modal-event-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.modal-event strong {
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.3;
  color: var(--ink);
}

.external-icon {
  display: inline-flex;
  align-items: center;
  opacity: 0.65;
  flex-shrink: 0;
  margin-top: 2px;
}

.modal-event-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.modal-info-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #404040;
  line-height: 1.25;
}

.modal-info-item.date-item {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: var(--border-thin) solid var(--line);
  border-radius: 9999px;
  padding: 2px 9px;
  gap: 5px;
}

/* SVG Flat Icons styling */
.flat-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  color: currentColor;
}

.modal-event::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 3px,
    rgba(0, 0, 0, 0.17) 3px 4px
  );
}

.modal-event:hover {
  filter: brightness(0.97);
}

@media (max-width: 768px) {
  dialog {
    width: min(540px, calc(100vw - 20px));
    border-radius: 8px;
  }

  .modal-header {
    min-height: 52px;
    padding: 0 14px;
  }

  .modal-title {
    font-size: 20px;
    letter-spacing: -0.4px;
  }

  .close-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  .modal-events {
    max-height: 75vh;
  }

  .modal-event {
    padding: 11px 14px;
    gap: 6px;
  }

  .modal-event strong {
    font-size: 14px;
  }

  .modal-info-item {
    font-size: 11px;
    gap: 5px;
  }
}

/* ==========================================================================
   Medium-Style Share Preview Modal
   ========================================================================== */

.share-dialog {
  width: min(560px, calc(100vw - 28px));
  padding: 0;
  border: var(--border-width) solid var(--line);
  box-shadow: none; /* No shadow on popup modal */
  background: var(--paper);
  color: var(--ink);
  border-radius: 12px;
  overflow: hidden;
}

.share-modal-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.share-section-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Ticket-Style Preview Card */
.share-preview-card {
  --punch-x: 130px;
  position: relative;
  display: flex;
  flex-direction: row;
  min-height: 140px;
  border: var(--border-width) solid var(--line);
  border-radius: 14px;
  box-shadow: none;
  background: #ffffff;
  overflow: hidden;
}

.share-ticket-notch-top {
  position: absolute;
  top: -1px;
  left: calc(var(--punch-x) - 9px);
  width: 18px;
  height: 10px;
  background: var(--paper);
  border: var(--border-width) solid var(--line);
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 10;
  pointer-events: none;
}

.share-ticket-notch-bottom {
  position: absolute;
  bottom: -1px;
  left: calc(var(--punch-x) - 9px);
  width: 18px;
  height: 10px;
  background: var(--paper);
  border: var(--border-width) solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  z-index: 10;
  pointer-events: none;
}

.share-card-rail {
  width: var(--punch-x);
  background: #1a2639;
  border-right: 2px dashed rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.share-card-rail::before {
  content: "";
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 60px;
  height: 60px;
  background: #8cd0ac;
  border-radius: 50%;
  opacity: 0.9;
  z-index: 1;
}

.share-card-rail::after {
  content: "";
  position: absolute;
  bottom: -15px;
  right: -15px;
  width: 50px;
  height: 50px;
  background: #a7b6f9;
  border-radius: 50%;
  opacity: 0.9;
  z-index: 1;
}

.share-card-rail-dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 14px 14px;
  background-position: 7px 7px;
  z-index: 2;
}

.share-card-brand-top {
  padding: 12px 10px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
}

.share-card-logo {
  display: block;
  width: 100px;
  height: auto;
  max-height: 24px;
}

.share-card-date-bottom {
  padding: 4px 8px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 3;
}

.share-card-day {
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.5px;
  color: #ffffff;
}

.share-card-weekday {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 4px;
  color: #8cd0ac;
}

.share-card-month {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
  opacity: 0.9;
}

.share-card-main {
  flex: 1;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 20px;
}

.ticket-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.ticket-shape-orange {
  position: absolute;
  top: -30px;
  right: -10px;
  width: 100px;
  height: 100px;
  background: #fec873;
  border-radius: 30px;
  transform: rotate(15deg);
}
.ticket-shape-orange::after {
  content: "";
  position: absolute;
  inset: 10px;
  background-image: radial-gradient(rgba(255,255,255,0.4) 1.5px, transparent 1.5px);
  background-size: 10px 10px;
}

.ticket-shape-green {
  position: absolute;
  top: 40px;
  right: -50px;
  width: 140px;
  height: 140px;
  background: #8cd0ac;
  border-radius: 50%;
}

.ticket-shape-pink {
  position: absolute;
  bottom: -40px;
  right: 60px;
  width: 90px;
  height: 90px;
  background: #f590ba;
  border-radius: 50%;
}

.ticket-shape-purple {
  position: absolute;
  bottom: -30px;
  left: 50%;
  width: 70px;
  height: 70px;
  background: #a7b6f9;
  border-radius: 50% 50% 0 0;
}

.ticket-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.share-card-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  background: #7f56d9;
  color: #ffffff;
  border-radius: 4px;
  margin-bottom: 6px;
}

.share-card-title {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.4px;
  color: #1a2639;
  max-width: 80%;
}

.ticket-title-underline {
  width: 50px;
  height: 3px;
  background: #8cd0ac;
  border-radius: 2px;
  margin-bottom: 12px;
}

.share-card-meta {
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  color: #333;
}

.share-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Minimal Icons Actions Row */
.share-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.share-copied-notice {
  font-size: 12px;
  font-weight: 800;
  color: #1f6f2c;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

[data-theme="dark"] .share-copied-notice,
:root:not([data-theme="light"]) .share-copied-notice {
  color: #4ade80;
}

.share-minimal-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: var(--border-width) solid var(--line);
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.1s ease, background 0.1s ease, box-shadow 0.1s ease;
}

.share-icon-btn:hover {
  background: var(--hover-bar);
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 var(--line);
}

.share-icon-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.share-icon-btn.btn-whatsapp:hover {
  background: #e7f9ee;
  color: #075e54;
}

.share-icon-btn.btn-messenger:hover {
  background: #eef4fc;
  color: #0084ff;
}

.share-icon-btn.btn-linkedin:hover {
  background: #eef4fc;
  color: #0a66c2;
}

@media (max-width: 500px) {
  .share-preview-card {
    flex-direction: column;
  }
  .share-ticket-notch-top,
  .share-ticket-notch-bottom {
    display: none;
  }
  .share-card-rail {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.25);
  }
  .share-card-brand-top {
    padding: 8px 12px;
  }
  .share-card-date-bottom {
    flex-direction: row;
    gap: 8px;
    padding: 8px 12px;
  }
  .share-card-day { font-size: 24px; }
  .share-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .share-minimal-icons {
    justify-content: center;
  }
}
