/* Open Graph Preview — style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0f1219;
    --bg2: #151d2b;
    --bg3: #1c2540;
    --border: rgba(99, 102, 241, 0.15);
    --border2: rgba(255, 255, 255, 0.05);
    --text: #eef0fb;
    --text2: #8b91c9;
    --text3: #3d4669;
    --primary: #6366f1;
    --primary2: #818cf8;
    --warn: #f59e0b;
    --green: #4ade80;
    --red: #f87171;
    --radius: 12px;
    --t: all 0.2s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 55% 35% at 15% 5%, rgba(99, 102, 241, 0.08), transparent), radial-gradient(ellipse 40% 25% at 85% 85%, rgba(129, 140, 248, 0.06), transparent);
    z-index: 0;
}

/* Header */
header {
    background: rgba(15, 18, 25, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.hdr {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.35);
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
}

h1.brand-title {
    display: inline;
}

.brand-sub {
    font-size: 10px;
    color: var(--text3);
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* Cards */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text2);
}

.card-body {
    padding: 14px;
}

/* Input col */
.input-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.preview-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Visual editor */
.visual-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hint {
    font-weight: 400;
    color: var(--text3);
    font-family: 'JetBrains Mono', monospace;
}

.hint.warn {
    color: var(--warn);
}

.hint.over {
    color: var(--red);
}

.field-hint {
    font-size: 10px;
    color: var(--text3);
    margin-top: 2px;
}

.field-row {
    display: flex;
    gap: 8px;
}

/* Char bar */
.char-bar-wrap {
    height: 3px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
}

.char-bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    background: var(--green);
    transition: width 0.3s ease, background 0.3s ease;
}

.char-bar.warn {
    background: var(--warn);
}

.char-bar.over {
    background: var(--red);
}

/* Mode toggle */
.mode-toggle {
    display: flex;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 7px;
    overflow: hidden;
}

.mode-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    transition: var(--t);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.mode-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Raw editor */
.raw-editor {
    display: flex;
    flex-direction: column;
}

.code-area {
    background: #07090f;
    color: #c7d0e8;
    border: none;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.7;
    outline: none;
    resize: none;
    width: 100%;
    min-height: 200px;
    tab-size: 2;
}

.code-area::placeholder {
    color: #2a3550;
}

.raw-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--border2);
    display: flex;
    gap: 6px;
    background: var(--bg2);
}

/* Inputs */
.inp {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 8px;
    color: var(--text);
    padding: 7px 10px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--t);
}

.inp:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.inp::placeholder {
    color: var(--text3);
}

.inp.mono {
    font-family: 'JetBrains Mono', monospace;
}

textarea.inp {
    resize: vertical;
}

select.inp {
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
}

.btn:hover {
    border-color: var(--primary2);
    color: var(--primary2);
}

.btn-sm {
    padding: 4px 9px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-ghost {
    background: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.btn-primary:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* Warnings */
.warning-item {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border2);
    font-size: 11px;
}

.warning-item:last-child {
    border-bottom: none;
}

.w-icon {
    font-size: 14px;
}

.w-text {
    color: var(--text2);
    line-height: 1.5;
}

.warn-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warn);
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
}

/* JSON-LD */
.json-ld-view {
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #a5b4fc;
    background: #07090f;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.7;
}

/* Facebook card */
.fb-preview-body {
    padding: 10px;
}

.fb-card {
    border: 1px solid #cdd0d4;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    max-width: 340px;
    margin: 0 auto;
}

.fb-img-wrap {
    width: 100%;
    aspect-ratio: 1.91;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.fb-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fb-img-placeholder {
    color: #bec3c9;
    font-size: 12px;
}

.fb-meta {
    padding: 10px 12px;
    background: #f0f2f5;
    border-top: 1px solid #cdd0d4;
}

.fb-domain {
    font-size: 11px;
    color: #606770;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.fb-title {
    font-size: 14px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 3px;
    line-height: 1.3;
}

.fb-desc {
    font-size: 12px;
    color: #606770;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Twitter card */
.tp-body {
    padding: 10px;
}

.tw-card {
    border: 1px solid #cfd9de;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    max-width: 340px;
    margin: 0 auto;
}

.tw-img-wrap {
    width: 100%;
    aspect-ratio: 1.778;
    background: #f7f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tw-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tw-img-placeholder {
    color: #8aa3b8;
    font-size: 12px;
}

.tw-meta {
    padding: 12px 14px;
}

.tw-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f1419;
    margin-bottom: 4px;
}

.tw-desc {
    font-size: 13px;
    color: #536471;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tw-domain {
    font-size: 13px;
    color: #536471;
    margin-top: 6px;
}

/* Slack card */
.slack-card {
    display: flex;
    gap: 0;
    border-left: 4px solid var(--primary);
    background: var(--bg3);
    border-radius: 4px;
    overflow: hidden;
}

.slack-bar {
    width: 4px;
    flex-shrink: 0;
}

.slack-content {
    padding: 10px 12px;
    flex: 1;
}

.slack-site {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.slack-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary2);
    margin-bottom: 3px;
}

.slack-desc {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.5;
}

.slack-img {
    margin-top: 8px;
    border-radius: 6px;
    overflow: hidden;
    max-width: 100%;
}

.slack-img img {
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: cover;
    border-radius: 6px;
}

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text);
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.22s ease;
    pointer-events: all;
}

.toast.show {
    transform: none;
    opacity: 1;
}

::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 3px
}

@media(max-width:900px) {
    main {
        grid-template-columns: 1fr;
    }
}