/* ============================================================
   Rich Results Tool – Equalza
   ============================================================ */

/* ---------- Layout ---------- */
.rr-tool {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.rr-panel {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--rl, 12px);
    padding: 28px;
    box-shadow: var(--sh, 0 1px 3px rgba(0,0,0,.06));
}

/* ---------- Schema Type Grid ---------- */
.rr-type-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.rr-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text2, #4b5563);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    text-align: center;
    line-height: 1.2;
}

.rr-type-btn:hover {
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
    background: rgba(37, 99, 235, .04);
}

.rr-type-btn.active {
    border-color: var(--accent, #2563eb);
    background: rgba(37, 99, 235, .08);
    color: var(--accent, #2563eb);
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

.rr-type-icon {
    font-size: 20px;
    line-height: 1;
}

/* ---------- Form Fields ---------- */
.rr-field {
    margin-bottom: 14px;
}

.rr-field label,
.rr-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #111827);
    margin-bottom: 5px;
}

.rr-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text, #111827);
    background: var(--surface, #fff);
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}

.rr-input:focus {
    outline: none;
    border-color: var(--accent, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

textarea.rr-input {
    resize: vertical;
    min-height: 64px;
}

.rr-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.rr-input-row .rr-field {
    flex: 1;
    margin-bottom: 0;
}

.rr-hint {
    font-size: 11px;
    color: var(--text3, #9ca3af);
    margin-top: 3px;
}

/* ---------- Dynamic Items (FAQ/HowTo/Breadcrumb) ---------- */
.rr-dynamic-items,
.rr-breadcrumb-items {
    margin-bottom: 16px;
}

.rr-dynamic-item {
    display: flex;
    gap: 10px;
    align-items: start;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    background: var(--bg, #f9fafb);
}

.rr-dynamic-item-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rr-dynamic-item-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #2563eb);
    min-width: 20px;
    padding-top: 8px;
}

.rr-btn-remove {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 4px;
    background: transparent;
    color: var(--red, #dc2626);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 6px;
}

.rr-btn-remove:hover {
    background: rgba(220, 38, 38, .05);
}

.rr-btn-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1px dashed var(--border, #e5e7eb);
    border-radius: 6px;
    background: transparent;
    color: var(--accent, #2563eb);
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

.rr-btn-add:hover {
    background: rgba(37, 99, 235, .05);
}

/* ---------- Actions ---------- */
.rr-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    margin-top: 8px;
}

.rr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 9px 18px;
    font-family: inherit;
}

.rr-btn svg { flex-shrink: 0; }

/* ---------- Privacy ---------- */
.rr-privacy {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #f0fdf4;
    border-radius: 8px;
    font-size: 12px;
    color: #059669;
    font-weight: 500;
}

.rr-privacy svg {
    flex-shrink: 0;
    stroke: #059669;
}

/* ============================================================
   OUTPUT PANEL
   ============================================================ */

.rr-output-panel {
    position: sticky;
    top: 120px;
}

/* ---------- Tabs ---------- */
.rr-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg, #f5f6f8);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 20px;
}

.rr-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text2, #4b5563);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
    flex: 1;
    justify-content: center;
}

.rr-tab:hover {
    color: var(--text, #111827);
}

.rr-tab.active {
    background: var(--surface, #fff);
    color: var(--accent, #2563eb);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.rr-tab svg { flex-shrink: 0; }

.rr-tab-content {
    display: none;
}

.rr-tab-content.active {
    display: block;
}

/* ---------- Code Block ---------- */
.rr-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.rr-code-lang {
    font-size: 12px;
    font-weight: 600;
    color: var(--text3, #9ca3af);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.rr-btn-copy,
.rr-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 6px;
    background: var(--surface, #fff);
    color: var(--text2, #4b5563);
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.rr-btn-copy:hover,
.rr-btn-download:hover {
    border-color: var(--accent, #2563eb);
    color: var(--accent, #2563eb);
}

.rr-code-block {
    background: #1e1e2e;
    border-radius: 10px;
    padding: 18px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    color: #cdd6f4;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    margin: 0;
    min-height: 200px;
    max-height: 500px;
    white-space: pre-wrap;
    word-break: break-word;
}

.rr-code-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ---------- Validation ---------- */
.rr-validate-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rr-validate-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.rr-validate-badge.pass {
    background: #f0fdf4;
    color: #059669;
}

.rr-validate-badge.warn {
    background: #fffbeb;
    color: #d97706;
}

.rr-validate-badge.error {
    background: #fef2f2;
    color: #dc2626;
}

.rr-validate-item {
    display: flex;
    align-items: start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: 13px;
}

.rr-validate-item:last-child {
    border-bottom: none;
}

.rr-validate-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.rr-validate-icon.pass { color: #059669; }
.rr-validate-icon.warn { color: #d97706; }
.rr-validate-icon.error { color: #dc2626; }

.rr-validate-msg {
    flex: 1;
}

.rr-validate-field {
    font-weight: 600;
    color: var(--text, #111827);
}

.rr-validate-desc {
    color: var(--text2, #4b5563);
    margin-top: 2px;
}

/* ---------- SERP Preview ---------- */
.rr-preview-note {
    font-size: 12px;
    color: var(--text3, #9ca3af);
    margin: 0 0 12px;
}

.rr-serp-frame {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #dadce0;
    font-family: 'Google Sans', Arial, sans-serif;
}

.rr-serp-url-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.rr-serp-favicon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rr-serp-site {
    font-size: 14px;
    color: #202124;
}

.rr-serp-title {
    font-size: 20px;
    line-height: 1.3;
    color: #1a0dab;
    margin-bottom: 4px;
    cursor: pointer;
}

.rr-serp-title:hover {
    text-decoration: underline;
}

.rr-serp-desc {
    font-size: 14px;
    line-height: 1.58;
    color: #4d5156;
}

.rr-serp-rich {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ebebeb;
}

.rr-serp-stars {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #70757a;
}

.rr-serp-stars-icons {
    color: #fbbc04;
    font-size: 15px;
    letter-spacing: 1px;
}

.rr-serp-price {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    margin-top: 4px;
}

.rr-serp-faq-item {
    border-bottom: 1px solid #ebebeb;
}

.rr-serp-faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
    font-size: 14px;
    color: #202124;
    user-select: none;
}

.rr-serp-faq-q:hover { color: #1a0dab; }

.rr-serp-faq-arrow {
    width: 20px;
    height: 20px;
    transition: transform .2s;
    color: #70757a;
    flex-shrink: 0;
}

.rr-serp-faq-item.open .rr-serp-faq-arrow {
    transform: rotate(180deg);
}

.rr-serp-faq-a {
    display: none;
    padding: 0 0 12px;
    font-size: 14px;
    line-height: 1.58;
    color: #4d5156;
}

.rr-serp-faq-item.open .rr-serp-faq-a {
    display: block;
}

.rr-serp-breadcrumbs {
    font-size: 12px;
    color: #4d5156;
    margin-bottom: 2px;
}

.rr-serp-breadcrumbs span {
    color: #70757a;
}

.rr-serp-event-date {
    font-size: 13px;
    color: #202124;
    font-weight: 500;
    margin-top: 4px;
}

.rr-serp-event-location {
    font-size: 13px;
    color: #70757a;
}

.rr-serp-recipe-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 13px;
    color: #70757a;
}

.rr-serp-howto-steps {
    margin-top: 6px;
}

.rr-serp-howto-step {
    font-size: 13px;
    color: #4d5156;
    padding: 4px 0;
}

.rr-serp-howto-step strong {
    color: #202124;
}

/* ============================================================
   TOAST
   ============================================================ */

.rr-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #202124;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    z-index: 10000;
    pointer-events: none;
}

.rr-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 960px) {
    .rr-tool {
        grid-template-columns: 1fr;
    }
    .rr-output-panel {
        position: static;
    }
}

@media (max-width: 600px) {
    .rr-panel {
        padding: 18px;
    }
    .rr-type-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .rr-input-row {
        flex-direction: column;
    }
    .rr-code-block {
        font-size: 11px;
        padding: 14px;
    }
}

@media (max-width: 400px) {
    .rr-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   RTL
   ============================================================ */

[dir="rtl"] .rr-tool {
    direction: rtl;
}

[dir="rtl"] .rr-code-block {
    direction: ltr;
    text-align: left;
}

[dir="rtl"] .rr-serp-frame {
    direction: rtl;
}

[dir="rtl"] .rr-privacy {
    direction: rtl;
}

[dir="rtl"] .rr-validate-item {
    direction: rtl;
}
