/* ============================================================
   Schema Markup Generator - tool-specific styles
   Composes the shared primitives in code/assets/css/tools.css.
   ============================================================ */

/* ---- Mode toggle pill sliding for our form/url modes ----- */

/* The shared .mode-toggle::before pill defaults to the left (form mode);
   when our wrapper carries data-mode="url" we slide it to the right slot. */
.mode-toggle[data-mode="url"]::before {
    transform: translateX(100%);
}

/* ---- URL row in URL mode ---------------------------------- */

.smg-url-row {
    margin-top: 18px;
    padding: 16px;
    border-radius: 10px;
    background: var(--ink-50);
    border: 1px solid var(--ink-100);
}
.smg-url-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-700);
    margin-bottom: 6px;
}
.smg-url-controls {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.smg-url-controls .text-input { flex: 1; }
.smg-url-controls .primary-btn { white-space: nowrap; }
.smg-url-help {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ink-600);
}

/* ---- Type picker (compact flat grid + auto-collapse) -------- */

.smg-type-section { margin-top: 18px; }
.smg-type-section[hidden] { display: none; }
.smg-type-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.smg-type-title {
    font-size: 16px;
    margin: 0;
    color: var(--ink-900);
}
.smg-type-meta {
    font-size: 12px;
    color: var(--ink-500);
}

/* Single flat grid: ~5 columns on wide viewports, wraps to fewer on narrow.
   Category info lives on the tile itself (tile-cat), not in section borders. */
.smg-type-grid-flat {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px;
}
.smg-type-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 6px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s, background 0.12s;
    text-align: left;
    min-height: 44px;
}
.smg-type-tile:hover {
    border-color: var(--brand-400);
    background: var(--brand-50);
}
.smg-type-tile:active { transform: translateY(1px); }
.smg-type-tile.is-active {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 2px var(--brand-100);
    background: var(--brand-50);
}
.smg-type-tile-name {
    font-weight: 500;
    font-size: 13px;
    color: var(--ink-900);
    line-height: 1.2;
}
.smg-type-tile-cat {
    font-size: 10px;
    color: var(--ink-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Deprecated note: tiny inline line of pills below the grid. */
.smg-deprecated-note {
    margin: 10px 0 0;
    font-size: 11px;
    color: var(--ink-500);
}
.smg-deprecated-pill {
    color: var(--ink-600);
    text-decoration: line-through;
    cursor: help;
}
.smg-deprecated-pill:hover { color: var(--ink-800); }
.smg-deprecated-sep {
    margin: 0 4px;
    color: var(--ink-400);
}

/* Picked-type collapsed bar: prominent banner with a type badge, name,
   category pill, and a one-line description. Brand-accented so the user
   has a clear "you are building X" anchor. */
.smg-picked-type {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 14px 18px;
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-left: 4px solid var(--brand-500);
    border-radius: 10px;
}
.smg-picked-type[hidden] { display: none; }

.smg-picked-type-body {
    flex: 1;
    min-width: 0;
}
.smg-picked-type-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--brand-700);
    font-weight: 600;
}
.smg-picked-type-headline {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 2px;
    flex-wrap: wrap;
}
.smg-picked-type-name {
    color: var(--ink-900);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
}
.smg-picked-type-cat {
    color: var(--brand-700);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    background: var(--brand-100);
    padding: 3px 8px;
    border-radius: 99px;
}
.smg-picked-type-desc {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--ink-600);
    line-height: 1.45;
}

/* Change link is intentionally subtle: it sits inline with the type name,
   reads as a text link, and darkens on hover (no background flip, no
   color inversion). */
.smg-picked-type-change {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0 0 0 4px;
    color: var(--brand-600);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.12s, text-decoration-thickness 0.12s;
}
.smg-picked-type-change:hover {
    color: var(--brand-700);
    text-decoration-thickness: 2px;
}
.smg-picked-type-change:focus-visible {
    outline: 2px solid var(--brand-300);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ---- Editor region ---------------------------------------- */

.smg-editor-region {
    margin-top: 24px;
    background: #fff;
    border: 1px solid var(--ink-100);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    overflow: visible;
}
.smg-editor-region[hidden] { display: none; }
.smg-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--ink-100);
    background: var(--ink-50);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}
.smg-editor-title {
    margin: 0;
    font-size: 18px;
    color: var(--ink-900);
}
.smg-editor-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--ink-600);
}
.smg-editor-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.smg-subtype-select {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--ink-300);
    background: #fff;
    font-family: inherit;
    font-size: 13px;
}

/* ---- Deprecation + existing banners ----------------------- */

.smg-deprecation-banner,
.smg-existing-banner {
    margin: 16px 20px 0;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid;
}
.smg-deprecation-banner {
    background: #fef3c7;
    border-color: #fde68a;
    color: #78350f;
}
.smg-deprecation-banner strong { color: #78350f; }
.smg-existing-banner {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #155e75;
}
.smg-existing-banner strong { color: #155e75; }
.smg-existing-list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
}
.smg-existing-list li {
    display: flex;
    gap: 6px;
    padding: 2px 0;
}
.smg-existing-list-type {
    font-weight: 600;
}

/* ---- Validation strip ------------------------------------- */

.smg-validation-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 20px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ink-50);
    border: 1px solid var(--ink-100);
    font-size: 13px;
}
.smg-validation-strip.is-ready {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}
.smg-validation-strip.is-warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #78350f;
}
.smg-validation-state strong { font-weight: 600; }
.smg-validation-detail {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--brand-600);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}
.smg-validation-issues {
    margin: 8px 20px 0;
    padding: 12px 14px;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    background: #fff;
}
.smg-validation-issues[hidden] { display: none; }
.smg-validation-issues-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}
.smg-validation-issues-list li {
    padding: 4px 0;
    color: var(--ink-700);
    cursor: pointer;
    border-bottom: 1px solid var(--ink-50);
}
.smg-validation-issues-list li:hover { background: var(--ink-50); }
.smg-validation-issues-list li:last-child { border-bottom: 0; }
.smg-validation-issues-list li.is-required:before {
    content: "•";
    color: #dc2626;
    margin-right: 8px;
    font-weight: 700;
}
.smg-validation-issues-list li.is-recommended:before {
    content: "•";
    color: #f59e0b;
    margin-right: 8px;
    font-weight: 700;
}
.smg-validation-issues-list li.is-format:before {
    content: "!";
    color: #dc2626;
    margin-right: 8px;
    font-weight: 700;
}

/* ---- Editor grid (form + output) -------------------------- */

.smg-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    padding: 16px 20px 20px;
}
@media (max-width: 960px) {
    .smg-editor-grid { grid-template-columns: 1fr; }
}

.smg-editor-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.smg-field-group {
    background: #fff;
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    padding: 14px 14px 8px;
}
.smg-field-group-title {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-700);
}
.smg-field-group-title .smg-req-badge {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.smg-req-badge.required    { background: #fee2e2; color: #991b1b; }
.smg-req-badge.recommended { background: #fef3c7; color: #78350f; }
.smg-req-badge.optional    { background: var(--ink-100); color: var(--ink-700); }

.smg-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--ink-100);
}
.smg-field:last-child { border-bottom: 0; }
.smg-field-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-800);
}
.smg-field-label .smg-field-flag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 1px 6px;
    border-radius: 99px;
}
.smg-field-flag.required    { background: #fee2e2; color: #991b1b; }
.smg-field-flag.recommended { background: #fef3c7; color: #78350f; }
.smg-field-flag.optional    { background: var(--ink-100); color: var(--ink-700); }

.smg-field-input,
.smg-field-textarea,
.smg-field-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ink-300);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink-900);
    background: #fff;
    box-sizing: border-box;
}
.smg-field-textarea { min-height: 70px; resize: vertical; font-family: inherit; line-height: 1.5; }
.smg-field-input:focus,
.smg-field-textarea:focus,
.smg-field-select:focus {
    outline: 2px solid var(--brand-300);
    outline-offset: 1px;
    border-color: var(--brand-400);
}
.smg-field-input.is-invalid,
.smg-field-textarea.is-invalid {
    border-color: #dc2626;
    background: #fef2f2;
}
.smg-field-help {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--ink-500);
    line-height: 1.4;
}
.smg-field-source {
    font-size: 11px;
    color: var(--brand-700);
    background: var(--brand-50);
    padding: 1px 6px;
    border-radius: 99px;
}
.smg-field-source[hidden] { display: none; }
.smg-field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-800);
    cursor: pointer;
}

/* ---- Repeater + array_of_text ----------------------------- */

.smg-repeater {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.smg-repeater-item {
    background: var(--ink-50);
    border: 1px solid var(--ink-100);
    border-radius: 6px;
    padding: 10px 12px;
    position: relative;
}
.smg-repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.smg-repeater-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-700);
}
.smg-repeater-remove,
.smg-array-remove {
    background: transparent;
    color: var(--ink-500);
    border: 0;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
}
.smg-repeater-remove:hover,
.smg-array-remove:hover {
    background: var(--ink-100);
    color: #dc2626;
}
.smg-repeater-add,
.smg-array-add {
    align-self: flex-start;
    background: #fff;
    border: 1px dashed var(--ink-300);
    color: var(--ink-700);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}
.smg-repeater-add:hover,
.smg-array-add:hover {
    border-color: var(--brand-400);
    color: var(--brand-700);
}
.smg-array-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}
.smg-array-row .smg-field-input,
.smg-array-row .smg-field-textarea {
    flex: 1;
}

/* ---- Output panel ----------------------------------------- */

.smg-editor-output {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
.smg-output-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.smg-output-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-900);
}
.smg-output-toggles {
    display: flex;
    align-items: center;
    gap: 10px;
}
.smg-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--ink-600);
    cursor: pointer;
}
.smg-jsonld-pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    overflow-x: auto;
    max-height: 360px;
    margin: 0;
}
.smg-jsonld-code {
    font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre;
}

/* ---- SERP preview ----------------------------------------- */

.smg-preview-section {
    background: var(--ink-50);
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    padding: 14px;
}
.smg-preview-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-900);
}
.smg-preview-hint {
    margin: 4px 0 12px;
    font-size: 12px;
    color: var(--ink-500);
}
.smg-serp-preview {
    background: #fff;
    border: 1px solid var(--ink-100);
    border-radius: 8px;
    padding: 14px;
    min-height: 110px;
    font-family: arial, sans-serif;
}
.smg-serp-preview-empty {
    color: var(--ink-400);
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

/* SERP preview: Article result */
.smg-serp-article {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 14px;
}
.smg-serp-article-thumb {
    width: 90px; height: 90px;
    border-radius: 8px;
    background: var(--ink-100) center/cover no-repeat;
}
.smg-serp-article-meta {
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 4px;
}
.smg-serp-article-headline {
    font-size: 18px;
    font-weight: 400;
    color: #1a0dab;
    margin: 0 0 6px;
    line-height: 1.3;
}
.smg-serp-article-desc {
    font-size: 13px;
    color: #4d5156;
    line-height: 1.5;
}

/* SERP preview: Product snippet */
.smg-serp-product {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 14px;
}
.smg-serp-product-thumb {
    width: 90px; height: 90px;
    border-radius: 4px;
    background: var(--ink-100) center/cover no-repeat;
}
.smg-serp-product-name {
    font-size: 18px;
    font-weight: 400;
    color: #1a0dab;
    margin: 0 0 4px;
}
.smg-serp-product-row {
    font-size: 13px;
    color: #4d5156;
    margin-top: 4px;
}
.smg-serp-stars {
    color: #fbbc04;
    letter-spacing: 1px;
    font-size: 13px;
}
.smg-serp-product-availability.is-instock { color: #137333; }
.smg-serp-product-availability.is-out     { color: #c5221f; }

/* SERP preview: FAQ */
.smg-serp-faq {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.smg-serp-faq-item {
    border-bottom: 1px solid var(--ink-100);
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #4d5156;
    font-size: 14px;
}
.smg-serp-faq-item:last-child { border-bottom: 0; }
.smg-serp-faq-deprecated {
    margin-top: 6px;
    padding: 6px 8px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    color: #78350f;
    font-size: 12px;
}

/* SERP preview: Breadcrumb */
.smg-serp-breadcrumb {
    font-size: 13px;
    color: #4d5156;
}
.smg-serp-breadcrumb-trail {
    display: inline-block;
    margin-bottom: 4px;
}
.smg-serp-breadcrumb-trail a {
    color: #4d5156;
    text-decoration: none;
}
.smg-serp-breadcrumb-headline {
    font-size: 18px;
    color: #1a0dab;
    margin: 0;
    font-weight: 400;
}

/* SERP preview: Event */
.smg-serp-event {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 12px;
}
.smg-serp-event-date {
    background: #fff;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    text-align: center;
    padding: 8px 6px;
}
.smg-serp-event-month {
    font-size: 11px;
    color: #c5221f;
    text-transform: uppercase;
    font-weight: 700;
}
.smg-serp-event-day {
    font-size: 22px;
    font-weight: 500;
    color: var(--ink-900);
}
.smg-serp-event-meta { font-size: 13px; color: #4d5156; }
.smg-serp-event-name {
    font-size: 16px;
    margin: 0 0 4px;
    color: var(--ink-900);
    font-weight: 600;
}

/* SERP preview: Recipe */
.smg-serp-recipe {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
}
.smg-serp-recipe-thumb {
    width: 110px; height: 80px;
    border-radius: 8px;
    background: var(--ink-100) center/cover no-repeat;
}
.smg-serp-recipe-name { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--ink-900); }
.smg-serp-recipe-meta { font-size: 13px; color: #4d5156; display: flex; gap: 12px; flex-wrap: wrap; }

/* SERP preview: Local Business */
.smg-serp-business {
    display: grid;
    grid-template-columns: 1fr 80px;
    gap: 12px;
}
.smg-serp-business-name { font-size: 18px; color: #1a0dab; margin: 0 0 4px; font-weight: 400; }
.smg-serp-business-meta { font-size: 13px; color: #4d5156; line-height: 1.5; }
.smg-serp-business-thumb {
    width: 80px; height: 80px;
    border-radius: 6px;
    background: var(--ink-100) center/cover no-repeat;
}

/* SERP preview: Job */
.smg-serp-job-title { font-size: 17px; color: #1a0dab; margin: 0 0 4px; font-weight: 500; }
.smg-serp-job-meta { font-size: 13px; color: #4d5156; line-height: 1.55; }
.smg-serp-job-pill {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 6px;
}

/* SERP preview: Video */
.smg-serp-video {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 14px;
}
.smg-serp-video-thumb-wrap {
    position: relative;
    width: 120px; height: 72px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--ink-100);
}
.smg-serp-video-thumb {
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
}
.smg-serp-video-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.smg-serp-video-duration {
    position: absolute;
    bottom: 4px; right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 2px;
}

/* SERP preview: Org / Person / Software / Review / Course / Website */
.smg-serp-card {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 12px;
    align-items: center;
}
.smg-serp-card-thumb {
    width: 60px; height: 60px;
    border-radius: 8px;
    background: var(--ink-100) center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-400);
    font-size: 24px;
    font-weight: 700;
}
.smg-serp-card-name { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--ink-900); }
.smg-serp-card-meta { font-size: 13px; color: #4d5156; }

/* ---- Rich Results CTA ------------------------------------- */

.smg-rich-results-cta {
    padding: 14px;
    border: 1px dashed var(--ink-200);
    border-radius: 8px;
    background: #fff;
    text-align: center;
    font-size: 13px;
    color: var(--ink-700);
}
.smg-rich-results-cta p { margin: 0 0 8px; }
.smg-rich-results-cta a {
    margin: 4px 4px 0;
    display: inline-block;
}

/* ---- Bottom banner --------------------------------------- */

.bottom-banner {
    margin-top: 28px;
    padding: 24px;
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    border-radius: 12px;
}
.bottom-banner-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.bottom-banner-title {
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--ink-900);
}
.bottom-banner-body {
    margin: 0;
    font-size: 13px;
    color: var(--ink-700);
}
@media (max-width: 640px) {
    .bottom-banner-inner { flex-direction: column; align-items: stretch; }
}
