/* Re-themed to SnapStatic dark + indigo by aliasing to styles-base --ss-* tokens. */
:root {
    --bg-primary: var(--ss-surface);
    --bg-secondary: var(--ss-bg);
    --bg-tertiary: var(--ss-surface-2);
    --text-primary: var(--ss-text);
    --text-secondary: var(--ss-text-dim);
    --text-muted: var(--ss-text-dim);
    --border-color: var(--ss-border);
    --accent: var(--ss-accent);
    --accent-hover: var(--ss-accent-hover);
    --warning: var(--ss-warn);
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* .container, header and footer are owned by the shared frame (styles-base.css). */

.hidden {
    display: none !important;
}

/* Header + tagline now rendered by the frame (.ss-nav + .tool-head). */

main {
    padding: 32px 16px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.url-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

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

#urlInput {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
}

#urlInput:focus {
    border-color: var(--accent);
}

#fetchBtn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#fetchBtn:hover {
    background: var(--accent-hover);
}

#fetchBtn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.or-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 12px;
}

.editor-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.input-with-counter {
    position: relative;
}

.input-with-counter input,
.input-with-counter textarea {
    width: 100%;
    padding: 10px 12px;
    padding-bottom: 24px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-with-counter input:focus,
.input-with-counter textarea:focus {
    border-color: var(--accent);
}

.input-with-counter .counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.input-with-counter .counter.warning {
    color: var(--warning);
}

.input-with-counter .counter.error {
    color: var(--error);
}

.form-group input[type="url"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input[type="url"]:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.checkbox-group {
    flex-direction: row;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.image-preview {
    margin-top: 8px;
    max-width: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px dashed var(--border-color);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

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

.preview-section h2 {
    font-size: 18px;
    font-weight: 600;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .preview-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 22px;
    }

    .header .tagline {
        font-size: 14px;
    }

    .url-input-wrapper {
        flex-direction: column;
    }

    #fetchBtn {
        width: 100%;
    }

    main {
        padding: 20px 12px;
        gap: 20px;
    }

    .url-section,
    .editor-section,
    .output-section {
        padding: 16px;
        border-radius: var(--radius-md);
    }

    .preview-section h2 {
        font-size: 16px;
    }

    .output-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }

    .output-actions {
        justify-content: stretch;
    }

    .btn-primary {
        width: 100%;
    }
}

.preview-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.preview-label {
    background: var(--bg-tertiary);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.preview-content {
    padding: 12px;
}

.google-preview {
    background: white;
    border: 1px solid var(--border-color);
}

.google-preview .preview-title {
    color: #1a0dab;
    font-size: 18px;
    line-height: 1.3;
    margin-bottom: 2px;
}

.google-preview .preview-url {
    color: #006621;
    font-size: 14px;
    margin-bottom: 4px;
}

.google-preview .preview-desc {
    color: #545454;
    font-size: 13px;
    line-height: 1.4;
}

.facebook-preview,
.twitter-preview,
.linkedin-preview {
    display: flex;
    border: 1px solid var(--border-color);
    background: white;
}

.preview-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image .image-placeholder {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.preview-info {
    padding: 12px;
    flex: 1;
    min-width: 0;
}

.preview-info .preview-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.preview-info .preview-url {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

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

.output-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.output-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 4px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-tertiary);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.output-content {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
}

.output-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.output-content code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.output-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* .footer and .toast are rendered/styled by the shared frame (styles-base.css). */

/* Social preview mocks pinned to realistic light styling (they mimic Facebook/Twitter/LinkedIn,
   which are light); without this their text would inherit the dark theme color and vanish. */
.preview-image { background: #e4e6eb; }
.preview-image .image-placeholder { color: #8a8d91; }
.preview-info .preview-title { color: #1c1e21; }
.preview-info .preview-url { color: #65676b; }
.preview-info .preview-desc { color: #606770; }