/* ==========================================================================
   Tools Embed Styles
   Overrides for embed mode (loaded inside iframes on third-party sites)
   ========================================================================== */

/* --- Shell Container (border + rounded corners around entire widget) --- */
.embed-shell {
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* --- Body / Layout --- */
body.embed-mode {
  margin: 0;
  padding: 8px;
  background: transparent;
  min-height: auto;
}

body.embed-mode .page-container,
body.embed-mode .page-container--narrow {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

body.embed-mode .tool-workspace {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Remove any page background overrides that tools set */
body.embed-mode.title-generator-page,
body.embed-mode.thumbnail-previewer-page,
body.embed-mode.subscribe-link-page,
body.embed-mode.money-calculator-page,
body.embed-mode.tag-generator-page,
body.embed-mode.embed-code-page,
body.embed-mode.hashtag-generator-page,
body.embed-mode.qr-code-page,
body.embed-mode.timestamp-link-page,
body.embed-mode.rss-feed-page,
body.embed-mode.description-generator-page,
body.embed-mode.bio-generator-page,
body.embed-mode.channel-name-generator-page,
body.embed-mode.channel-name-ideas-page,
body.embed-mode.engagement-rate-page,
body.embed-mode.channel-id-finder-page {
  background: transparent;
}

/* --- Branded Header Bar --- */
.embed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  color: #fff;
  font-size: 13px;
  min-height: 40px;
}

.embed-header__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
  opacity: 0.95;
  transition: opacity 150ms ease;
}

.embed-header__brand:hover {
  opacity: 1;
}

.embed-header__logo {
  flex-shrink: 0;
  border-radius: 4px;
}

/* Override the SVG fill for the header version (white bg, indigo text) */
.embed-header__logo rect {
  fill: rgba(255, 255, 255, 0.2);
}
.embed-header__logo text {
  fill: #fff;
}

.embed-header__title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-header__cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 150ms ease;
  white-space: nowrap;
}

.embed-header__cta:hover {
  background: rgba(255, 255, 255, 0.25);
}

.embed-header__cta i {
  font-size: 10px;
}

/* --- Embed Body (wraps the tool content) --- */
.embed-body {
  padding: 20px 20px 8px;
}

/* --- Powered-by Footer --- */
.embed-footer {
  text-align: center;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--color-gray-500, #64748b);
  background: var(--color-gray-50, #f8fafc);
  border-top: 1px solid var(--color-gray-200, #e2e8f0);
  line-height: 1.4;
}

.embed-footer a {
  color: var(--color-primary, #4F46E5);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 150ms ease;
}

.embed-footer a:hover {
  color: var(--color-primary-dark, #4338CA);
  text-decoration: underline;
}

.embed-footer__icon {
  flex-shrink: 0;
}

.embed-footer__sep {
  margin: 0 5px;
  color: var(--color-gray-300, #cbd5e1);
}

.embed-footer__tagline {
  color: var(--color-gray-400, #94a3b8);
}

/* --- Embed Section on Tool Pages (non-embed view) --- */
.tool-embed-section {
  margin-top: 40px;
  padding: 0;
  background: #fff;
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
}

/* Toggle header */
.tool-embed-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: #fff;
  border: none;
  padding: 20px 24px;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  transition: background 150ms ease;
}

.tool-embed-section__toggle:hover {
  background: var(--color-gray-100, #f1f5f9);
}

.tool-embed-section__toggle-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tool-embed-section__toggle-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary, #4F46E5);
  color: #fff;
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
}

.tool-embed-section__toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-embed-section__toggle-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-gray-800, #1e293b);
}

.tool-embed-section__toggle-desc {
  font-size: 13px;
  color: var(--color-gray-500, #64748b);
  font-weight: 400;
}

.tool-embed-section__chevron {
  font-size: 14px;
  color: var(--color-gray-400, #94a3b8);
  transition: transform 200ms ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.tool-embed-section__toggle.is-open .tool-embed-section__chevron {
  transform: rotate(180deg);
}

/* Body (collapsible) */
.tool-embed-section__body {
  display: none;
  padding: 0 24px 24px;
  border-top: 1px solid var(--color-gray-200, #e2e8f0);
}

.tool-embed-section__body.is-open {
  display: block;
}

/* Steps */
.tool-embed-section__step {
  padding-top: 20px;
}

.tool-embed-section__step + .tool-embed-section__step {
  padding-top: 24px;
  border-top: 1px solid var(--color-gray-100, #f1f5f9);
  margin-top: 24px;
}

.tool-embed-section__step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-gray-700, #334155);
  margin-bottom: 12px;
}

.tool-embed-section__step-num {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary, #4F46E5);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Dimension controls */
.tool-embed-section__controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.tool-embed-section__control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-embed-section__control label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray-600, #475569);
}

.tool-embed-section__control .form-control {
  width: 160px;
  max-width: 100%;
}

/* Color picker */
.tool-embed-section__color-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-embed-section__color-input {
  width: 42px;
  height: 42px;
  border: 2px solid var(--color-gray-200, #e2e8f0);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: #fff;
  flex-shrink: 0;
}

.tool-embed-section__color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.tool-embed-section__color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.tool-embed-section__color-input::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

.tool-embed-section__color-hex {
  width: 100px !important;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 13px;
  text-transform: uppercase;
}

/* Code block + copy button */
.tool-embed-section__code-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-embed-section__code {
  width: 100%;
  min-height: 72px;
  padding: 14px 16px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-gray-800, #1e293b);
  background: var(--color-gray-50, #f8fafc);
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 8px;
  resize: none;
  word-break: break-all;
  box-sizing: border-box;
}

.tool-embed-section__code:focus {
  outline: none;
  border-color: var(--color-primary, #4F46E5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tool-embed-section__copy-btn {
  align-self: flex-start;
}

/* Preview */
.tool-embed-section__preview {
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 10px;
  padding: 0;
  background: var(--color-gray-50, #f8fafc);
  overflow: hidden;
}

.tool-embed-section__preview iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 400px;
}

/* --- Responsive (embed mode) --- */
@media (max-width: 767px) {
  body.embed-mode {
    padding: 4px;
  }

  .embed-header {
    padding: 8px 12px;
    gap: 8px;
    font-size: 12px;
  }

  .embed-header__title {
    font-size: 11px;
  }

  .embed-header__cta {
    display: none;
  }

  .embed-body {
    padding: 12px 12px 4px;
  }

  .embed-footer {
    padding: 8px;
    font-size: 11px;
  }

  .embed-shell {
    border-radius: 8px;
  }

  /* Embed section responsive */
  .tool-embed-section__toggle {
    padding: 16px;
  }

  .tool-embed-section__toggle-icon {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .tool-embed-section__toggle-title {
    font-size: 15px;
  }

  .tool-embed-section__toggle-desc {
    font-size: 12px;
  }

  .tool-embed-section__body {
    padding: 0 16px 16px;
  }

  .tool-embed-section__controls {
    flex-direction: column;
    gap: 12px;
  }

  .tool-embed-section__control {
    max-width: 100%;
  }
}

/* --- Embed Directory Widget --- */
.embed-directory {
  padding: 0;
}

.embed-directory__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-gray-900, #0f172a);
  margin: 0 0 4px;
  text-align: center;
}

.embed-directory__subtitle {
  font-size: 14px;
  color: var(--color-gray-500, #64748b);
  margin: 0 0 20px;
  text-align: center;
}

.embed-directory__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.embed-directory__card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--color-gray-200, #e2e8f0);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 150ms ease;
}

.embed-directory__card:hover {
  border-color: var(--color-primary, #4F46E5);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
  transform: translateY(-1px);
}

.embed-directory__card-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray-100, #f1f5f9);
  border-radius: 8px;
  color: var(--color-primary, #4F46E5);
  font-size: 15px;
  flex-shrink: 0;
}

.embed-directory__card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-800, #1e293b);
  line-height: 1.3;
}

@media (max-width: 767px) {
  .embed-directory__grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .embed-directory__card {
    padding: 10px;
    gap: 8px;
  }

  .embed-directory__card-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .embed-directory__card-title {
    font-size: 12px;
  }

  .embed-directory__title {
    font-size: 16px;
  }

  .embed-directory__subtitle {
    font-size: 12px;
    margin-bottom: 12px;
  }
}

@media (max-width: 400px) {
  .embed-directory__grid {
    grid-template-columns: 1fr;
  }
}
