/* 
 * Open Graph Preview Styles
 * Theme: Teal Frost (#0A1A1A bg, #00CEC9 primary, #81ECEC secondary, #FF7675 accent)
 */

:root {
    --bg-main: #0A1A1A;
    --bg-surface: #122828;
    --bg-elevated: #1A3636;
    --bg-card: #0D2121;

    --primary: #00CEC9;
    --primary-hover: #00B2AE;
    --secondary: #81ECEC;
    --accent: #FF7675;

    --text-main: #F1F4F4;
    --text-muted: #8B9D9D;
    --border: #234242;
    --danger: #FF7675;

    --font-main: 'Inter', system-ui, sans-serif;
    --font-code: 'Fira Code', monospace;

    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius: 8px;
    --radius-sm: 4px;

    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 206, 201, 0.15);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.hidden {
    display: none !important;
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.p-0 {
    padding: 0 !important;
}

.scroll-y {
    overflow-y: auto;
}

.text-muted {
    color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

/* --- Left Config Panel --- */
.config-panel {
    width: 360px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.panel-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at top left, rgba(0, 206, 201, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #0984E3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    box-shadow: var(--shadow-glow);
}

.logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 0.2rem;
    margin-left: 3rem;
}

.config-content {
    flex: 1;
    padding: 1.5rem;
}

.config-content h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"],
input[type="url"],
textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.1);
}

.input-with-icon,
.input-with-btn {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input,
.input-with-btn input {
    padding-left: 2.25rem;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
}

.input-with-btn input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-with-btn .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.char-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

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

.image-preview-mini {
    height: 120px;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.panel-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline:hover {
    background: rgba(0, 206, 201, 0.1);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
}

.btn-icon:hover,
.btn-icon.active {
    color: var(--primary);
}

/* --- Right Workspace --- */
.preview-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    position: relative;
}

.workspace-header {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 26, 26, 0.8);
    backdrop-filter: blur(10px);
    z-index: 5;
}

.workspace-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.preview-scroll {
    flex: 1;
    padding: 2rem;
    padding-bottom: 4rem;
}

.previews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    align-items: start;
}

.preview-wrapper {
    background: transparent;
    display: flex;
    flex-direction: column;
}

.platform-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}

/* ==============================================================
   SOCIAL MEDIA METICULOUS SIMULATION CSS
   ============================================================== */

/* Common Utils inside cards */
.sc-image-ext {
    width: 100%;
    height: 210px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #f0f0f0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sc-domain {
    font-size: 0.85rem;
    color: #536471;
    text-transform: lowercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sc-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f1419;
    margin: 0.1rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.sc-desc {
    font-size: 0.85rem;
    color: #536471;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Twitter Card */
.twitter-card {
    background: #ffffff;
    border: 1px solid #cfd9de;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.2s;
}

.twitter-card:hover {
    background: #f7f9f9;
}

.twitter-card .sc-image-ext {
    border-bottom: 1px solid #cfd9de;
    height: 200px;
}

.twitter-card .sc-content {
    padding: 0.75rem 1rem;
}

.twitter-card .sc-title {
    -webkit-line-clamp: 1;
    margin-top: 2px;
}

/* LinkedIn Card */
.linkedin-card {
    background: #eef3f8;
    /* LinkedIn often shows share card on a gray/blue bg */
    border-radius: 2px;
    /* Very sharp */
    cursor: pointer;
}

.linkedin-card .sc-image-ext {
    border: none;
    height: 210px;
}

.linkedin-card .sc-content {
    padding: 0.5rem 1rem 0.5rem;
    background: #eef3f8;
    border: 1px solid #00000024;
    border-top: none;
}

.linkedin-card .sc-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #000000e6;
    -webkit-line-clamp: 2;
}

.linkedin-card .sc-domain {
    font-size: 0.75rem;
    color: #00000099;
    margin-top: 0.25rem;
}

/* Facebook Card */
.facebook-card {
    background: #f0f2f5;
    border: 1px solid #ced0d4;
    cursor: pointer;
}

.facebook-card .sc-image-ext {
    border-bottom: 1px solid #ced0d4;
    height: 210px;
}

.facebook-card .sc-content {
    padding: 10px 12px;
    background: #f0f2f5;
}

.facebook-card .text-uppercase {
    text-transform: uppercase;
    font-size: 0.7rem;
    color: #65676B;
    font-weight: 600;
}

.facebook-card .text-black {
    color: #050505;
    font-size: 1rem;
    font-weight: 600;
    margin: 0.2rem 0;
    -webkit-line-clamp: 2;
}

.facebook-card .sc-desc {
    color: #65676B;
    font-size: 0.85rem;
}

/* Discord Card */
.discord-card {
    background: #313338;
    /* Discord dark */
    border-radius: 4px;
    padding: 1rem;
    border-left: 4px solid #202225;
    max-width: 450px;
}

.discord-card .sc-title {
    color: #00A8FC;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
}

.discord-card .sc-title:hover {
    text-decoration: underline;
    cursor: pointer;
}

.discord-card .sc-desc {
    color: #DBDEE1;
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.discord-card .sc-image-ext {
    border-radius: 4px;
    max-width: 100%;
    height: auto;
    padding-top: 56.25%;
    /* 16:9 ratio */
    background-size: cover;
    border: none;
}

/* Slack Card */
.slack-card {
    background: transparent;
    padding: 0 0 0 12px;
    position: relative;
    max-width: 450px;
}

.slack-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #DDDDE5;
    border-radius: 4px;
}

.slack-card .sc-domain-flex {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.slack-card .sc-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
}

.slack-card .text-bold {
    font-weight: 700;
    color: #1D1C1D;
}

.slack-card .text-blue {
    color: #0B4C8C;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.slack-card .sc-desc {
    color: #1D1C1D;
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.slack-card .sc-image-ext {
    border-radius: 8px;
    max-width: 300px;
    padding-top: 56.25%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* iMessage Card */
.iMessage-container {
    background: #000;
    padding: 1rem;
    border-radius: 24px;
    border: 4px solid #333;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.im-bubble {
    background: #0A84FF;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
}

.imessage-card {
    background: #2C2C2E;
    border-radius: 18px;
    overflow: hidden;
    width: 250px;
}

.imessage-card .sc-image-ext {
    height: 140px;
    border: none;
}

.imessage-card .sc-content {
    padding: 8px 12px;
    background: #3A3A3C;
}

.imessage-card .sc-title {
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: -apple-system, sans-serif;
}

.imessage-card .text-gray {
    color: #8E8E93;
}

.imessage-card .text-xs {
    font-size: 0.75rem;
    margin-top: 2px;
}


/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.2s;
}

.modal-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform: translateY(0);
    transition: transform 0.2s;
}

.modal-backdrop.hidden .modal {
    transform: translateY(20px);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

pre {
    margin: 0;
}

code {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--secondary);
    display: block;
    padding: 1.5rem;
    background: var(--bg-card);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.hl-tag {
    color: #FF7675;
}

.hl-attr {
    color: #00CEC9;
}

.hl-val {
    color: #A29BFE;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 100px);
    background: var(--bg-elevated);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    border: 1px solid var(--primary);
    font-size: 0.875rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .previews-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .config-panel {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .preview-workspace {
        height: 50vh;
    }
}