/* Open Graph Preview Debugger — styles.css */

:root {
    --bg: #0F0A1A;
    --bg2: #140F22;
    --surface: #1C183A;
    --surface2: #241E45;
    --border: #2E2855;
    --primary: #8B5CF6;
    --secondary: #A78BFA;
    --accent: #F472B6;
    --success: #34D399;
    --warn: #FBBF24;
    --danger: #F87171;
    --text: #EDE9FE;
    --muted: #7C6FAE;
    --radius: 12px;
    --glass: rgba(139, 92, 246, 0.08);
    --glass-b: rgba(167, 139, 250, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image: radial-gradient(ellipse 60% 50% at 10% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ──────────────────────────────────────────── */
header {
    background: rgba(9, 6, 16, 0.9);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

header h1 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
}

.tagline {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 3px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ── URL Bar ─────────────────────────────────────────── */
.url-bar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.url-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.url-input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', monospace;
}

.url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.url-input::placeholder {
    color: var(--muted);
}

.badge-proxy {
    font-size: 0.6rem;
    opacity: 0.7;
}

.url-note {
    font-size: 0.67rem;
    color: var(--muted);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    background: #7C3AED;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--secondary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.72rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition: all 0.15s;
}

.btn-sm:hover {
    color: var(--text);
    border-color: var(--secondary);
}

.btn-danger-sm {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger-sm:hover {
    background: rgba(248, 113, 113, 0.2);
}

.w-full {
    width: calc(100% - 20px);
    display: block;
}

/* ── App Grid ────────────────────────────────────────── */
.app-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    padding: 20px 20px 40px;
}

/* ── Panel Shared ────────────────────────────────────── */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.panel-actions {
    display: flex;
    gap: 6px;
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Tag Editor ──────────────────────────────────────── */
.tag-editor-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tag-fields {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
}

.field-group {}

.field-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 5px;
}

.field-req {
    color: var(--danger);
    font-size: 0.6rem;
    margin-left: 4px;
}

.field-rec {
    color: var(--warn);
    font-size: 0.6rem;
    margin-left: 4px;
}

.field-input,
.field-select {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.field-input:focus,
.field-select:focus {
    border-color: var(--primary);
}

.field-input::placeholder {
    color: var(--muted);
}

.field-ta {
    resize: vertical;
    min-height: 60px;
}

.field-hint {
    font-size: 0.62rem;
    color: var(--muted);
    margin-top: 4px;
}

.char-hint {
    font-size: 0.62rem;
    color: var(--muted);
    text-align: right;
    margin-top: 3px;
}

.char-over {
    color: var(--danger) !important;
}

/* ── Validation ──────────────────────────────────────── */
.validation-panel {
    background: rgba(248, 113, 113, 0.04);
    border-top: 1px solid rgba(248, 113, 113, 0.25);
}

.issues-list {
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.issue-item {
    font-size: 0.72rem;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.15);
}

.issue-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.issue-error .issue-dot {
    background: var(--danger);
}

.issue-warn .issue-dot {
    background: var(--warn);
}

.issue-info .issue-dot {
    background: var(--secondary);
}

.issue-error {
    border-color: rgba(248, 113, 113, 0.3);
}

.issue-warn {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.25);
}

.issue-info {
    background: rgba(167, 139, 250, 0.06);
    border-color: rgba(167, 139, 250, 0.2);
    color: var(--secondary);
}

/* ── Previews Panel ──────────────────────────────────── */
.previews-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.platform-tabs {
    display: flex;
    gap: 4px;
}

.tab-btn {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--text);
}

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

.preview-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.preview-placeholder {
    text-align: center;
    padding: 60px 20px;
}

.ph-icon {
    font-size: 3rem;
    opacity: 0.15;
    margin-bottom: 14px;
}

.ph-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
}

.ph-sub {
    font-size: 0.78rem;
    color: #4B3F80;
    margin-top: 8px;
}

.preview-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ── Social Cards ────────────────────────────────────── */
.social-card-wrap {}

.social-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
}

/* Twitter/X large card */
.tw-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #2F3336;
    background: #000;
    max-width: 504px;
    font-family: -apple-system, sans-serif;
}

.tw-card .og-image {
    width: 100%;
    aspect-ratio: 1.91/1;
    object-fit: cover;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.8rem;
}

.tw-card .og-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tw-card .og-meta {
    padding: 12px;
    border-top: 1px solid #2F3336;
}

.tw-card .og-domain {
    font-size: 0.72rem;
    color: #6B7280;
}

.tw-card .og-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #E7E9EA;
    margin-top: 2px;
    line-height: 1.3;
}

/* Facebook */
.fb-card {
    border: 1px solid #DAD;
    background: #fff;
    overflow: hidden;
    font-family: Helvetica, sans-serif;
    max-width: 504px;
}

.fb-card .og-image {
    width: 100%;
    aspect-ratio: 1.91/1;
    background: #e4e6eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.8rem;
}

.fb-card .og-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.fb-card .og-domain {
    font-size: 0.68rem;
    color: #606770;
    text-transform: uppercase;
}

.fb-card .og-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1C1E21;
}

.fb-card .og-desc {
    font-size: 0.73rem;
    color: #606770;
    margin-top: 3px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* LinkedIn */
.li-card {
    border: 1px solid #E0E0E0;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    font-family: -apple-system, sans-serif;
    max-width: 504px;
}

.li-card .og-image {
    width: 100%;
    aspect-ratio: 1.91/1;
    background: #c3c3c3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.8rem;
}

.li-card .og-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.li-card .og-meta {
    padding: 10px 14px;
    border-top: 1px solid #E0E0E0;
}

.li-card .og-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1D2226;
    line-height: 1.3;
}

.li-card .og-domain {
    font-size: 0.72rem;
    color: #666;
    margin-top: 4px;
}

/* Slack */
.sl-card {
    background: #1A1D21;
    border: 1px solid #565856;
    border-left: 4px solid #E01E5A;
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Lato', sans-serif;
    max-width: 420px;
    display: flex;
    gap: 12px;
}

.sl-card .sl-text {
    flex: 1;
}

.sl-card .og-domain {
    font-size: 0.72rem;
    color: #ABABAD;
}

.sl-card .og-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #D1D2D3;
    margin-top: 3px;
}

.sl-card .og-desc {
    font-size: 0.75rem;
    color: #ABABAD;
    margin-top: 3px;
}

.sl-card .sl-thumb {
    width: 80px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.sl-card .sl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Discord */
.dc-card {
    background: #2F3136;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Whitney', sans-serif;
    max-width: 420px;
}

.dc-card .og-domain {
    font-size: 0.72rem;
    color: #00B0F4;
}

.dc-card .og-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
    margin-top: 4px;
}

.dc-card .og-desc {
    font-size: 0.75rem;
    color: #DCDDDE;
    margin-top: 4px;
}

.dc-card .dc-image {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1.91/1;
    margin-top: 10px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #292b2f;
    color: #555;
    font-size: 0.78rem;
}

.dc-card .dc-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── History Side Panel ──────────────────────────────── */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: slide-in-right 0.22s ease;
}

.side-panel.hidden {
    display: none;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
}

.close-btn:hover {
    color: var(--text);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--muted);
    transition: all 0.15s;
    word-break: break-all;
}

.history-item:hover {
    border-color: var(--primary);
    color: var(--text);
}

.history-time {
    font-size: 0.62rem;
    color: #4B3F80;
    margin-top: 3px;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 190;
}

.overlay.hidden {
    display: none;
}

/* ── Toast ───────────────────────────────────────────── */
#toast-wrap {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toast {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    color: var(--text);
    animation: slide-right 0.2s ease;
    max-width: 260px;
}

.toast.success {
    border-color: rgba(52, 211, 153, 0.4);
    color: var(--success);
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--danger);
}

@keyframes slide-right {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
    }
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }

    .tag-fields {
        max-height: none;
    }
}