/* ============================================
   Open Graph Card Designer — Styles
   Theme: Clean social media card preview style
   ============================================ */

:root {
    --primary: #4A90D9;
    --primary-rgb: 74, 144, 217;
    --secondary: #5B9BD5;
    --accent: #E4405F;
    --twitter: #1DA1F2;
    --linkedin: #0077B5;
    --facebook: #1877F2;
    --background: #0F1117;
    --surface: #1A1D26;
    --surface-hover: #242832;
    --border: rgba(74, 144, 217, 0.12);
    --border-hover: rgba(74, 144, 217, 0.25);
    --text-primary: #E8ECF0;
    --text-secondary: #8B95A2;
    --text-muted: #4A5568;
    --success: #2ECC71;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 200ms ease;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

.glass-panel {
    background: rgba(26, 29, 38, 0.8);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

/* Header */
.app-header {
    padding: 32px 0 24px;
    text-align: center;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

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

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--twitter), var(--linkedin), var(--facebook));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Layout */
.main-content {
    padding-bottom: 40px;
}

.editor-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Editor Fields */
.field-group {
    margin-bottom: 14px;
}

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

.char-count {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
}

.char-count.warn {
    color: #F39C12;
}

.char-count.over {
    color: #E74C3C;
}

.field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.field-row .field-group {
    flex: 1;
    margin-bottom: 0;
}

.input-field {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition);
    resize: vertical;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

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

.input-field.mono {
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.select-field {
    width: 100%;
    padding: 8px 28px 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    appearance: none;
    cursor: pointer;
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238B95A2' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.color-input {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
}

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.03);
}

.image-upload-area.has-image {
    padding: 0;
    border-style: solid;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.upload-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.preview-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
}

.btn-secondary {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

.editor-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

/* Templates */
.templates-section {
    margin-top: 4px;
}

.templates-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.template-card {
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.template-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.template-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.template-preview {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* Preview */
.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.platform-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.platform-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}

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

.platform-tab.active {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
}

.preview-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Card Previews */
.card-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.card-preview .card-image {
    width: 100%;
    aspect-ratio: 1.91 / 1;
    background: #1A1A2E;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
}

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

.card-preview .card-body {
    padding: 12px 16px;
}

.card-preview .card-domain {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.card-preview .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-preview .card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-preview .card-platform-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.card-preview.twitter .card-platform-badge {
    background: rgba(29, 161, 242, 0.12);
    color: var(--twitter);
}

.card-preview.linkedin .card-platform-badge {
    background: rgba(0, 119, 181, 0.12);
    color: var(--linkedin);
}

.card-preview.facebook .card-platform-badge {
    background: rgba(24, 119, 242, 0.12);
    color: var(--facebook);
}

/* Meta Output */
.meta-output {
    margin-top: 8px;
}

.meta-code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.section-header {
    margin-bottom: 10px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: toastIn 200ms ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

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

    .editor-panel {
        order: 1;
    }

    .preview-panel {
        order: 2;
    }
}

@media (max-width: 480px) {
    .field-row {
        flex-direction: column;
    }

    .templates-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .editor-actions {
        flex-direction: column;
    }
}