/* ============================================================
 *  Landing Page Generator UI
 * ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f7fb;
  color: #0a1e3f;
  line-height: 1.55;
  font-size: 14px;
}

.g-container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ----- header ----- */
.g-header {
  background: #0a1e3f;
  color: #fff;
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.g-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: opacity .15s;
}
.g-brand:hover { opacity: .85; }
.g-brand__logo {
  width: 34px; height: 34px;
  background: #fff;
  border-radius: 7px;
  padding: 3px;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  flex-shrink: 0;
}
.g-brand > div { line-height: 1.25; }
.g-brand strong { display: block; font-size: 14px; font-weight: 700; }
.g-brand > div > span { display: block; font-size: 11px; opacity: .75; }
.g-brand__by { display: inline; color: #d4af37; font-weight: 700; opacity: 1; }

.g-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ----- buttons ----- */
.g-btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.g-btn--primary {
  background: #d4af37;
  color: #0a1e3f;
}
.g-btn--primary:hover { background: #c8a951; transform: translateY(-1px); }
.g-btn--ghost {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}
.g-btn--ghost:hover { background: rgba(255,255,255,.15); }

.g-btn--danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.g-btn--danger:hover { background: #fee2e2; }

.g-btn--add {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 12px;
  padding: 6px 12px;
}
.g-btn--add:hover { background: #d1fae5; }

/* ----- layout ----- */
.g-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 64px;
  align-items: start;
}
/* When live preview is on: nav | form | preview (3-col on wide screens) */
body.preview-on .g-container { max-width: 100%; padding: 0 16px; }
body.preview-on .g-layout {
  grid-template-columns: 200px minmax(420px, 1fr) minmax(420px, 1fr);
  gap: 16px;
}
@media (max-width: 1280px) {
  body.preview-on .g-layout { grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr); }
  body.preview-on .g-nav { display: none; }
}
@media (max-width: 900px) {
  body.preview-on .g-layout { grid-template-columns: 1fr; }
  body.preview-on .g-preview {
    position: fixed;
    inset: 70px 8px 8px 8px;
    z-index: 100;
    height: auto;
  }
}
/* Maximize: hide nav + form, preview takes full container width */
body.preview-on.preview-max .g-layout { grid-template-columns: 1fr; }
body.preview-on.preview-max .g-nav,
body.preview-on.preview-max .g-form { display: none; }
body.preview-on.preview-max .g-preview { height: calc(100vh - 100px); }

/* ----- left nav ----- */
.g-nav {
  position: sticky;
  top: 90px;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.g-nav__link {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: #475569;
  text-decoration: none;
  border-radius: 6px;
  border-left: 3px solid transparent;
}
.g-nav__link:hover { background: #f1f5f9; color: #0a1e3f; }
.g-nav__link.active {
  background: #f1f5f9;
  color: #0a1e3f;
  border-left-color: #d4af37;
  font-weight: 600;
}

/* ----- form cards ----- */
.g-form { display: flex; flex-direction: column; gap: 20px; }
.g-card {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  scroll-margin-top: 90px;
}
.g-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  color: #0a1e3f;
}
.g-card h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #475569;
  margin: 20px 0 10px;
}
.g-card p.g-hint {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 14px;
}
.g-card p.g-hint code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.g-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}

.g-card input,
.g-card textarea,
.g-card select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fafbfc;
  color: #0a1e3f;
  transition: border-color .15s, background .15s;
  outline: none;
}
.g-card input:focus,
.g-card textarea:focus,
.g-card select:focus {
  border-color: #0a1e3f;
  background: #fff;
}
.g-card textarea { resize: vertical; min-height: 60px; line-height: 1.5; }

.g-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .g-row { grid-template-columns: 1fr; } }

/* ----- list items (testimonials, FAQ, etc.) ----- */
.g-listrow {
  background: #fafbfc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}
.g-listrow__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.g-listrow__head strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #64748b;
}
.g-listrow .g-row { gap: 10px; }
.g-listrow input,
.g-listrow textarea {
  background: #fff;
}

/* ----- image slots ----- */
.g-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.g-imageslot {
  display: block;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 14px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.g-imageslot:hover { border-color: #d4af37; background: #fffbeb; }
.g-imageslot.has-file { border-color: #16a34a; background: #f0fdf4; }
.g-imageslot__title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #0a1e3f;
  font-family: 'Courier New', monospace;
}
.g-imageslot__desc {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  margin-bottom: 8px;
}
.g-imageslot input[type=file] { font-size: 11px; }
.g-imageslot__preview {
  display: block;
  margin-top: 8px;
  width: 100%;
  height: 80px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.g-imageslot.has-file .g-imageslot__preview {
  border-radius: 6px;
}

/* ----- modal ----- */
.g-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,30,63,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.g-modal[hidden] { display: none !important; }
.g-modal__card {
  background: #fff;
  padding: 32px 40px;
  border-radius: 12px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.g-modal__card h3 { margin-bottom: 6px; font-size: 17px; }
.g-modal__card p { font-size: 13px; color: #64748b; }

.g-spinner {
  width: 48px; height: 48px;
  margin: 0 auto 18px;
  border: 4px solid #e2e8f0;
  border-top-color: #d4af37;
  border-radius: 50%;
  animation: g-spin .8s linear infinite;
}
@keyframes g-spin { to { transform: rotate(360deg); } }

.g-modal__success {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
}
.g-modal__btn {
  margin-top: 20px;
  background: #0a1e3f;
  color: #fff;
  font-weight: 600;
  border: 0;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

/* ----- toast ----- */
.g-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0a1e3f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.g-toast.is-visible { opacity: 1; }
.g-toast--error { background: #dc2626; }

@media (max-width: 900px) {
  .g-layout { grid-template-columns: 1fr; }
  .g-nav { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .g-nav__link { border-left: none; border-bottom: 3px solid transparent; padding: 6px 10px; }
  .g-nav__link.active { border-bottom-color: #d4af37; border-left: none; }
}

/* ----- live preview pane ----- */
.g-preview {
  position: sticky;
  top: 80px;
  height: calc(100vh - 100px);
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(10, 30, 63, .08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.g-preview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #0a1e3f;
  color: #fff;
  flex-wrap: wrap;
}
.g-preview__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.g-preview__title strong { font-size: 13px; letter-spacing: .3px; }
.g-preview__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 8px #16a34a;
  animation: g-pulse 2s ease-in-out infinite;
}
@keyframes g-pulse { 50% { opacity: .4; } }
.g-preview__status {
  font-size: 11px;
  opacity: .7;
  margin-left: 4px;
  font-style: italic;
}
.g-preview__status.is-busy { color: #fbbf24; opacity: 1; font-style: normal; }
.g-preview__status.is-ready { color: #6ee7b7; opacity: 1; font-style: normal; }
.g-preview__actions {
  display: flex; align-items: center; gap: 4px;
}
.g-preview__select {
  font-family: inherit;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
}
.g-preview__select option { color: #0a1e3f; }
.g-preview__head .g-btn {
  padding: 4px 8px;
  font-size: 13px;
  background: rgba(255,255,255,.1);
  color: #fff;
  border-color: rgba(255,255,255,.15);
}
.g-preview__head .g-btn:hover { background: rgba(255,255,255,.18); }
.g-preview__frame-wrap {
  flex: 1;
  background: #f1f5f9;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.g-preview iframe {
  border: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  display: block;
}
.g-preview[data-device="tablet"] iframe {
  width: 820px;
  max-width: 100%;
  margin: 12px auto;
  height: calc(100% - 24px);
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  border-radius: 6px;
}
.g-preview[data-device="mobile"] iframe {
  width: 390px;
  max-width: 100%;
  margin: 12px auto;
  height: calc(100% - 24px);
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
  border-radius: 12px;
}

/* ----- manual favicon override (collapsible) ----- */
.g-favicon-manual {
  margin-top: 24px;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
.g-favicon-manual > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #0a1e3f;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.g-favicon-manual > summary::before {
  content: '▶';
  font-size: 10px;
  transition: transform .15s;
  color: #6b7280;
}
.g-favicon-manual[open] > summary::before { transform: rotate(90deg); }
.g-favicon-manual__hint {
  font-weight: 400;
  font-size: 12px;
  color: #6b7280;
}
.g-favicon-manual > .g-hint { margin-top: 10px; }
.g-favicon-manual > .g-images { margin-top: 12px; }

/* ----- footer ----- */
.g-footer {
  background: #0a1e3f;
  color: #fff;
  margin-top: 60px;
  padding: 32px 0 24px;
}
.g-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.g-footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.g-footer__logo {
  width: 36px; height: 36px;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  object-fit: contain;
}
.g-footer__brand strong { display: block; font-size: 15px; }
.g-footer__brand span { display: block; font-size: 12px; opacity: .7; }
.g-footer__links {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
}
.g-footer__links a {
  color: #d4af37;
  text-decoration: none;
  font-weight: 600;
}
.g-footer__links a:hover { text-decoration: underline; }
.g-footer__sep { opacity: .4; }
.g-footer__copy {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 11px;
  opacity: .55;
}
@media (max-width: 700px) {
  .g-footer__inner { justify-content: center; text-align: center; }
  .g-footer__brand { justify-content: center; }
}
