/* ============================
   REUSABLE DARK SEARCH INPUT
============================ */
.rs-search-wrap{
  display:flex;
  justify-content:flex-end;
  width:100%;
}
.rs-search-input{
  width:100%;
  background:#181818;
  border:1px solid #303030;
  border-radius:6px;
  padding:8px 10px;
  color:#ffffff;
  font-size:18px;
  font-family:Inter, Arial, sans-serif;
  outline:none;
  box-sizing:border-box;
}
.rs-search-input::placeholder{ color:#777777; }
.rs-search-input:focus{
  border-color:#505050;
  outline:none;
  box-shadow:none;
}
@media (max-width: 600px){
  .rs-search-input{ font-size:16px; }
}


/* Event Manager Core - Frontend */
#emc-frontend{
  max-width:1100px;
  margin:0 auto 12px;
  padding:0 16px;
  margin-top:-80px;
  font-family:Inter,Arial,Helvetica,sans-serif;
  color:#fff;
}

.emc-topbar{
  display:flex;
  align-items:flex-start; /* CITY_LABEL_SIZE_PATCH_V1 */
  gap:12px;
  justify-content:flex-start;
  width:100%;
  margin:0 0 12px 0;
}

.emc-topbar{
  flex-wrap:nowrap;
}

.emc-location{
  min-width:0;
}

#emcLocBtn{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:520px;
}

#emcLocText{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  display:inline-block;
  max-width:100%;
}

/* CITY_LABEL_SIZE_PATCH_V1 */
#emcLocBtn{ font-size:22px; line-height:1.1; margin-top:2px; }
#emcLocText{ font-size:22px; line-height:1.1; }
@media (max-width: 600px){
  #emcLocBtn, #emcLocText{ font-size:20px; }
}

.emc-search{
  min-width:0;
}

#emcSearch{
  min-width:0;
}


.emc-location button{
  background:transparent;
  border:0;
  color:#fff;
  font-weight:800;
  font-size:18px;
  cursor:pointer;
}

.emc-search{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  max-width:520px;
  width:100%;
  position:relative;
}


#emcClear{display:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:none;
  background:transparent;
  color:#bbb;
  padding:0 6px;
  font-size:18px;
  line-height:1;
  cursor:pointer;
}

.emc-date{
  color:#fff;
  font-weight:800;
  font-size:14px;
  margin-top:10px;
}

/* Event cards */
.emc-event-card{
  display:flex;
  flex-direction:column;
  gap:0;
  padding:12px;
  background:#1f1f1f;
  border-radius:6px 6px 0 0;
  margin:8px 0 0;
}

.emc-main-row{
  display:flex;
  gap:12px;
  align-items:flex-start;
}

.emc-left img{
  width:65px;
  height:65px;
  object-fit:cover;
  border-radius:4px;
}

.emc-body{
  flex:1;
  min-width:0;
}

.emc-title{
  font-weight:900;
  color:#fff;
  margin:0;
  cursor:pointer;
}

.emc-desc{
  color:#ccc;
  margin-top:6px;
  font-size:14px;
}

.emc-right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  align-self:center;
}

.emc-btn{
  background:#e50914;
  color:#fff;
  border:0;
  padding:8px 12px;
  border-radius:6px;
  cursor:pointer;
  font-size:13px;
}

/* Sponsored glow */
.emc-sponsored{
  box-shadow:0 0 18px rgba(229,9,20,0.45);
  animation:emcSponsoredPulse 1.8s ease-in-out infinite;
}

@keyframes emcSponsoredPulse{
  0%{box-shadow:0 0 6px rgba(229,9,20,0.25);}
  50%{box-shadow:0 0 20px rgba(229,9,20,0.7);}
  100%{box-shadow:0 0 6px rgba(229,9,20,0.25);}
}

/* Expanded section fully attached to card */
.emc-expanded{
  display:none;
  margin:0 0 8px 0;
  padding:8px 12px 10px 12px;
  background:#1f1f1f;
  border-radius:0 0 6px 6px;
  border-top:none;
}

.emc-expanded-btn{
  display:block;
  width:100%;
  text-align:center;
  margin-top:8px;
}

/* More button */
.emc-more-wrap{
  text-align:center;
  margin-bottom:12px;
}

.emc-more-btn{
  background:#151515;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.08);
}

/* Empty state */
.emc-empty{
  color:#9b9b9b;
  margin-top:16px;
}

/* Mobile tweaks */
@media (max-width: 640px){
  .emc-topbar{
    flex-direction:column;
    align-items:flex-start;
  }
  .emc-search{
    margin-left:0;
    max-width:100%;
  }
  .emc-main-row{
    flex-direction:row;
  }
  .emc-title,
  .emc-desc{
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }
}


#emcSearchDropdown{
  font-size:13px;
}

#emcSearchDropdown .emc-search-suggestion{
  white-space:nowrap;
  text-overflow:ellipsis;
  overflow:hidden;
}

@media (max-width: 768px){
  #emc-frontend{ margin-top:-40px; }
}




/* ==========================================================================
   STABILITY FIXES (large event counts + zero-event cities)
   - Prevent upward "creep" as event count increases (margin-collapse)
   - Prevent city/search from shifting when switching to empty cities
   ========================================================================== */
#emc-frontend{
  /* Create a layout boundary so child margins cannot escape upward */
  display: flow-root;
  /* Prevent theme-level vertical-centering / reflow shifts when list is empty */
  min-height: 70vh;
}

#emcList{
  /* Separate list from header/search consistently */
  display: flow-root;
  padding-top: 14px;
}

/* Keep topbar height stable even when the list is empty */
.emc-topbar{
  min-height: 56px;
}

/* Mobile: slightly larger min-height to avoid jumpiness on iOS */
@media (max-width: 640px){
  #emc-frontend{ min-height: 78vh; }
}



/* CITY_DESCENDER_FIX_V1: prevent clipped letters like g/y/p */
#emcLocBtn, #emcLocText{
  line-height: 1.25;
  padding-bottom: 2px;
}

/* === Event date emphasis === */
.emc-event-date,
.rs-event-date,
.emc-date {
    font-size: 15px;
    line-height: 1.3;
}

/* === Header alignment fix (city + search) === */
.emc-header,
.emc-top,
.emc-search-row {
    display: flex;
    align-items: center;
}

.emc-search {
    margin-left: auto;
}

/* === FIX: Top bar alignment (city label + search) === */
.emc-topbar{
  display:flex;
  align-items:center;
  gap:14px;
}
.emc-location{display:flex; align-items:center;}
.emc-search{margin-left:auto; display:flex; align-items:center;}

/* === FIX: Date heading bigger + subtle separator line === */
.emc-date{
  font-size:20px !important;
  line-height:1.25;
  padding:10px 0 8px;
  margin:8px 0 0;
  border-bottom:1px solid rgba(255,255,255,0.14);
}

/* === FINAL FIX: Search X fully inside input === */
.rs-search-wrap{
  position:relative;
  display:flex;
  align-items:center;
}

.rs-search-input{
  width:100%;
  padding-right:42px; /* space for X */
}

#emcClear{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  height:20px;
  width:20px;
  line-height:20px;
  text-align:center;
  border-radius:50%;
  background:rgba(255,255,255,0.08);
  display:none;
}

/* === MOBILE FIX: Search suggestions dropdown width === */
@media (max-width: 768px){
  .emc-search{
    position:relative;
  }

  .emc-search .rs-search-results,
  .emc-search .rs-search-dropdown,
  .emc-search ul{
    width:100% !important;
    max-width:100% !important;
    left:0 !important;
    right:0 !important;
    box-sizing:border-box;
  }
}

.emc-affiliate-btn{margin-left:8px;}

/* Keep affiliate button aligned when rendered as a full-width expanded button */
.emc-expanded .emc-affiliate-btn{margin-left:0;}

/* === Affiliate button: ensure same full width + spacing === */
.emc-expanded .emc-expanded-btn{
  width:100%;
  display:block;
  box-sizing:border-box;
}
.emc-expanded .emc-expanded-btn + .emc-expanded-btn{
  margin-top:10px; /* spacing between Tickets and Affiliate */
}
