/* =========================================================
   GHS v3.0 — Event Entry UI (MASTER CSS)
   Location: /wp-content/plugins/ghs-event-input/assets/event-entry.css

   Single source of truth for:
   - Live Preview layout + visibility + typography
   - Upload + Media Library button row + status text
   - Hiding native file input (prevents "Choose file / No file chosen")
========================================================= */


/* =========================================================
   A) Live Preview layout + image crop
========================================================= */

.ghs-event-form .ghs-event-preview{
  display: grid;
  grid-template-columns: 260px 1fr;   /* KNOB */
  gap: 24px;                          /* KNOB */
  align-items: start;
}

.ghs-event-form .ghs-ep-image{
  width: 100%;
  aspect-ratio: 1 / 1;                /* KNOB */
  overflow: hidden;
  border-radius: 8px;                 /* KNOB */
  background: #f2f2f2;                /* KNOB */
}

.ghs-event-form .ghs-preview-image{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ghs-event-form .ghs-preview-image-fallback{
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Content under both columns */
.ghs-event-form .ghs-preview-content{
  grid-column: 1 / -1;
  margin-top: 6px;

  /* baseline visible */
  display: block;
}

/* Force visible when non-empty (beats rogue display:none) */
.ghs-event-form .ghs-preview-content:not(:empty){
  display: block !important;
}

/* Hide only when empty */
.ghs-event-form .ghs-preview-content:empty{
  display: none;
}

/* Typography (moved here so we can keep theme file inert) */
.ghs-event-form .ghs-preview-title{
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.ghs-event-form .ghs-preview-excerpt{
  margin: 0 0 12px 0;
  font-size: 16px;
}

.ghs-event-form .ghs-ep-meta{
  margin: 0 0 12px 0;
}

.ghs-event-form .ghs-ep-row{
  margin-bottom: 6px;
}

.ghs-event-form .ghs-ep-k{
  font-weight: 700;
}

.ghs-event-form .ghs-preview-content{
  font-size: 16px;
  line-height: 1.5;
}

.ghs-event-form .ghs-preview-content p{
  margin: 0 0 10px 0;
}

.ghs-event-form .ghs-preview-content p:last-child{
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px){
  .ghs-event-form .ghs-event-preview{
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ghs-event-form .ghs-preview-content{
    grid-column: auto;
  }
}

/* Elementor editor canvas */
.elementor-editor-active .ghs-event-form .ghs-event-preview{
  display: grid !important;
  grid-template-columns: 260px 1fr !important;
  gap: 24px !important;
  align-items: start !important;
}
.elementor-editor-active .ghs-event-form .ghs-preview-content{
  grid-column: 1 / -1 !important;
  margin-top: 6px !important;
  display: block !important;
}
.elementor-editor-active .ghs-event-form .ghs-preview-content:empty{
  display: none !important;
}


/* =========================================================
   B) Event Image field — Upload + Media buttons + status
========================================================= */

/* KNOBS */
:root{
  --ghs-img-btn-h:           40px;
  --ghs-img-btn-px:          18px;
  --ghs-img-btn-radius:      6px;
  --ghs-img-btn-bg:          #F0F4F8;
  --ghs-img-btn-text:        #102A43;
  --ghs-img-btn-bg-hover:    #39ACE7;
  --ghs-img-btn-text-hover:  #ffffff;
  --ghs-img-gap:             10px;
}

/* Keep the upload field group neat:
   label row, then our custom row */
.ghs-event-form
.elementor-field-group.elementor-field-type-upload.elementor-field-group-event_featured_image{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--ghs-img-gap);
  row-gap: 8px;
}

/* Elementor label on its own row (do not restyle) */
.ghs-event-form
.elementor-field-group.elementor-field-type-upload.elementor-field-group-event_featured_image
> label.elementor-field-label{
  flex: 0 0 100%;
  width: 100%;
  margin-bottom: 6px;
}

/* ✅ CRITICAL FIX:
   Hide the native file input ("Choose file / No file chosen") */
.ghs-event-form
.elementor-field-group-event_featured_image input[type="file"]{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

/* Container row created/used by event-preview.js */
.ghs-event-form .elementor-field-group-event_featured_image .custom-upload-mimic{
  display: inline-flex;
  align-items: center;
  gap: var(--ghs-img-gap);
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

/* Hide the “temporary UI holder” if it exists (from old HTML widget) */
.ghs-event-form #ghs-media-ui{
  display: none !important;
}

/* Both buttons (label + button) */
.ghs-event-form .elementor-field-group-event_featured_image .ghs-upload-label,
.ghs-event-form .elementor-field-group-event_featured_image .custom-choose-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ghs-img-btn-h);
  padding: 0 var(--ghs-img-btn-px);
  line-height: 1;
  border-radius: var(--ghs-img-btn-radius);
  background-color: var(--ghs-img-btn-bg);
  color: var(--ghs-img-btn-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

/* Hover */
.ghs-event-form .elementor-field-group-event_featured_image .ghs-upload-label:hover,
.ghs-event-form .elementor-field-group-event_featured_image .custom-choose-btn:hover{
  background-color: var(--ghs-img-btn-bg-hover);
  color: var(--ghs-img-btn-text-hover);
}

/* Status text */
.ghs-event-form .elementor-field-group-event_featured_image .custom-file-status{
  font-size: 14px;
  color: var(--ghs-img-btn-text);
  line-height: var(--ghs-img-btn-h);
  min-width: 140px;
  white-space: nowrap;
}

/* Small screens: status drops below buttons */
@media (max-width: 700px){
  .ghs-event-form .elementor-field-group-event_featured_image .custom-file-status{
    width: 100%;
    margin-top: 4px;
    white-space: normal;
    line-height: 1.4;
  }
}

/* Very small screens: stack buttons full width */
@media (max-width: 480px){
  .ghs-event-form .elementor-field-group-event_featured_image .custom-upload-mimic{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .ghs-event-form .elementor-field-group-event_featured_image .ghs-upload-label,
  .ghs-event-form .elementor-field-group-event_featured_image .custom-choose-btn{
    width: 100%;
  }
}
