/**
 * AI Document Converter landing-page demo
 * Visual styles aligned with image/PDF → Word / LaTeX / Markdown converter pages.
 * Scope: .ai-doc-landing-demo
 */

.ai-doc-landing-demo {
    --ai-doc-demo-accent: var(--accent-color, #2c2c2c);
    --ai-doc-demo-text: var(--text-color, #2c2c2c);
    --ai-doc-demo-muted: var(--text-secondary, #6b6b6b);
    --ai-doc-demo-panel-height: 32rem;
    width: 100%;
    font-family: 'Outfit', sans-serif;
    color: var(--ai-doc-demo-text);
}

.ai-doc-landing-demo * {
    box-sizing: border-box;
}

.ai-doc-landing-demo .ai-doc-demo-hint-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.ai-doc-landing-demo .ai-doc-demo-hint-bar p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--ai-doc-demo-muted);
    line-height: 1.5;
}

.ai-doc-landing-demo .ai-doc-demo-hint-bar strong {
    color: var(--ai-doc-demo-text);
    font-weight: 600;
}

.ai-doc-landing-demo .ai-doc-demo-reset {
    border: 1px solid rgba(26, 26, 26, 0.12);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ai-doc-demo-text);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

.ai-doc-landing-demo .ai-doc-demo-reset:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #fff;
}

.ai-doc-landing-demo .ai-doc-demo-reset:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ai-doc-landing-demo .tool-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}

.ai-doc-landing-demo .tool-panel,
.ai-doc-landing-demo .preview-panel {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 24px;
    box-shadow: 0 14px 36px rgba(26, 26, 26, 0.07);
    padding: 1.35rem;
    height: var(--ai-doc-demo-panel-height);
    min-height: var(--ai-doc-demo-panel-height);
    max-height: var(--ai-doc-demo-panel-height);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-doc-landing-demo .panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    min-height: 2.5rem;
    flex-shrink: 0;
}

.ai-doc-landing-demo .panel-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.ai-doc-landing-demo .panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
    color: var(--ai-doc-demo-text);
}

.ai-doc-landing-demo .upload-credit-cost {
    font-size: 0.78rem;
    font-weight: 500;
    color: #8a8a8a;
    line-height: 1.35;
}

.ai-doc-landing-demo .result-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
    justify-content: flex-end;
}

.ai-doc-landing-demo .action-button,
.ai-doc-landing-demo .ghost-button {
    border: none;
    border-radius: 999px;
    padding: 0.7rem 1.05rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.ai-doc-landing-demo .action-button {
    background: var(--ai-doc-demo-accent);
    color: #fff;
    box-shadow: 0 8px 20px rgba(44, 44, 44, 0.16);
}

.ai-doc-landing-demo .action-button.panel-header-action {
    background: transparent;
    color: var(--ai-doc-demo-text);
    border: 1.5px solid rgba(44, 44, 44, 0.35);
    box-shadow: none;
}

.ai-doc-landing-demo .action-button.panel-header-action:hover:not(:disabled) {
    background: rgba(245, 243, 240, 0.95);
    border-color: rgba(44, 44, 44, 0.55);
}

.ai-doc-landing-demo .ghost-button {
    background: transparent;
    color: var(--ai-doc-demo-text);
    border: 1px solid rgba(26, 26, 26, 0.1);
}

.ai-doc-landing-demo .action-button:hover:not(:disabled),
.ai-doc-landing-demo .ghost-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.ai-doc-landing-demo .action-button:disabled,
.ai-doc-landing-demo .ghost-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.ai-doc-landing-demo .upload-dropzone {
    border: 1.5px dashed rgba(44, 44, 44, 0.22);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 243, 240, 0.65));
    padding: 1rem;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.ai-doc-landing-demo .upload-placeholder {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
    padding: 0.75rem 1rem;
}

.ai-doc-landing-demo .upload-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-doc-demo-muted);
    flex-shrink: 0;
}

.ai-doc-landing-demo .upload-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    display: block;
}

.ai-doc-landing-demo .upload-placeholder strong {
    font-size: 1.02rem;
    color: var(--ai-doc-demo-text);
}

.ai-doc-landing-demo .upload-placeholder > p {
    margin: 0;
    color: var(--ai-doc-demo-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 26rem;
}

.ai-doc-landing-demo .preview-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

.ai-doc-landing-demo .preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--ai-doc-demo-muted);
    font-size: 0.88rem;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-doc-landing-demo .preview-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    overflow: hidden;
}

.ai-doc-landing-demo .preview-media-row {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    overflow: hidden;
}

.ai-doc-landing-demo .preview-image-wrap,
.ai-doc-landing-demo .pdf-preview-placeholder {
    position: relative;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(26, 26, 26, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-doc-landing-demo .preview-image-wrap img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ai-doc-landing-demo .pdf-preview-placeholder {
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.25rem;
    text-align: center;
}

.ai-doc-landing-demo .pdf-preview-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.2rem;
    padding: 0.35rem 0.7rem;
    border-radius: 10px;
    background: rgba(44, 44, 44, 0.08);
    color: var(--ai-doc-demo-text);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ai-doc-landing-demo .pdf-preview-label {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ai-doc-demo-text);
}

.ai-doc-landing-demo .pdf-preview-hint {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ai-doc-demo-muted);
    line-height: 1.5;
    max-width: 18rem;
}

.ai-doc-landing-demo .preview-remove-one {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.7rem;
    height: 1.7rem;
    border: none;
    border-radius: 999px;
    background: rgba(44, 44, 44, 0.82);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.ai-doc-landing-demo .preview-filename {
    margin: 0;
    max-width: 100%;
    font-size: 0.82rem;
    color: var(--ai-doc-demo-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.ai-doc-landing-demo .preview-nav {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ai-doc-landing-demo .preview-nav-action {
    border: 1px solid rgba(26, 26, 26, 0.12);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ai-doc-demo-text);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.ai-doc-landing-demo .preview-nav-action:hover:not(:disabled) {
    background: #fff;
}

.ai-doc-landing-demo .preview-nav-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-doc-landing-demo .result-viewport {
    border: 1.5px dashed rgba(44, 44, 44, 0.22);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 243, 240, 0.65));
    padding: 1rem;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ai-doc-landing-demo .result-viewport.is-filled {
    border-style: solid;
    border-color: rgba(26, 26, 26, 0.08);
    background: rgba(255, 255, 255, 0.92);
}

.ai-doc-landing-demo .result-empty,
.ai-doc-landing-demo .result-analyzing {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
    color: var(--ai-doc-demo-muted);
    padding: 1.5rem 1rem;
    line-height: 1.65;
}

.ai-doc-landing-demo .result-empty strong {
    color: var(--ai-doc-demo-text);
    font-size: 1rem;
}

.ai-doc-landing-demo .converter-spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid rgba(44, 44, 44, 0.2);
    border-top-color: var(--ai-doc-demo-accent);
    animation: ai-doc-demo-spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: -0.12rem;
    margin-right: 0.4rem;
}

.ai-doc-landing-demo .result-analyzing .converter-spinner {
    width: 1.6rem;
    height: 1.6rem;
    margin-right: 0;
}

@keyframes ai-doc-demo-spin {
    to { transform: rotate(360deg); }
}

.ai-doc-landing-demo .markdown-output {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 10px;
    padding: 0.15rem 0.45rem 0.15rem 0.15rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(44, 44, 44, 0.32) transparent;
    --doc-illustration-max-width: 35%;
}

.ai-doc-landing-demo .markdown-output::-webkit-scrollbar {
    width: 6px;
}

.ai-doc-landing-demo .markdown-output::-webkit-scrollbar-track {
    background: transparent;
    margin: 0.2rem 0;
}

.ai-doc-landing-demo .markdown-output::-webkit-scrollbar-thumb {
    background: rgba(44, 44, 44, 0.22);
    border-radius: 999px;
}

.ai-doc-landing-demo .markdown-output::-webkit-scrollbar-thumb:hover {
    background: rgba(44, 44, 44, 0.4);
}

.ai-doc-landing-demo .markdown-output h1,
.ai-doc-landing-demo .markdown-output h2,
.ai-doc-landing-demo .markdown-output h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--ai-doc-demo-text);
    line-height: 1.3;
    margin: 1rem 0 0.55rem;
}

.ai-doc-landing-demo .markdown-output h1:first-child,
.ai-doc-landing-demo .markdown-output h2:first-child,
.ai-doc-landing-demo .markdown-output h3:first-child {
    margin-top: 0;
}

.ai-doc-landing-demo .markdown-output p,
.ai-doc-landing-demo .markdown-output li {
    color: var(--ai-doc-demo-text);
    line-height: 1.7;
    font-size: 0.96rem;
}

.ai-doc-landing-demo .markdown-output img {
    max-width: var(--doc-illustration-max-width, 35%);
    width: auto;
    height: auto;
    border-radius: 8px;
    margin: 0.75rem 0;
    display: block;
}

.ai-doc-landing-demo .markdown-output table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    display: block;
    overflow-x: auto;
}

.ai-doc-landing-demo .markdown-output th,
.ai-doc-landing-demo .markdown-output td {
    border: 1px solid rgba(26, 26, 26, 0.12);
    padding: 0.45rem 0.6rem;
}

.ai-doc-landing-demo .markdown-output .katex {
    font-size: 1.05em;
}

.ai-doc-landing-demo .markdown-output .katex-display {
    margin: 0.85rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.ai-doc-landing-demo .preview-bottom-note {
    margin-top: 0.75rem;
    padding-top: 0;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    width: 100%;
}

.ai-doc-landing-demo .chat-bottom-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(26, 26, 26, 0.08);
    color: var(--ai-doc-demo-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.ai-doc-landing-demo .note-close-btn {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem 0.25rem;
}

.ai-doc-landing-demo .ai-doc-demo-feedback {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--ai-doc-demo-muted);
    flex-shrink: 0;
    min-height: 1.2em;
}

.ai-doc-landing-demo .ai-doc-demo-feedback.success {
    color: var(--success-color, #2e7d32);
}

.ai-doc-landing-demo .ai-doc-demo-feedback.info {
    color: var(--ai-doc-demo-muted);
}

.ai-doc-landing-demo .ai-doc-demo-feedback.error {
    color: var(--error-color, #c62828);
}

/* Sample gallery below the converter panels */
.ai-doc-landing-demo .ai-doc-demo-samples-section {
    margin-top: 1.75rem;
    padding: 1.35rem 1.25rem 1.45rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(26, 26, 26, 0.05);
}

.ai-doc-landing-demo .ai-doc-demo-samples-heading {
    margin: 0 0 0.35rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ai-doc-demo-text);
    text-align: center;
}

.ai-doc-landing-demo .ai-doc-demo-samples-lead {
    margin: 0 auto 1.15rem;
    max-width: 36rem;
    text-align: center;
    color: var(--ai-doc-demo-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.ai-doc-landing-demo .ai-doc-demo-samples {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
    align-items: stretch;
    width: 100%;
}

.ai-doc-landing-demo .ai-doc-demo-sample {
    position: relative;
    border: 1.5px solid rgba(26, 26, 26, 0.1);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    padding: 0;
    text-align: left;
    font: inherit;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    box-shadow: 0 8px 20px rgba(26, 26, 26, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.ai-doc-landing-demo .ai-doc-demo-sample:hover,
.ai-doc-landing-demo .ai-doc-demo-sample:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(44, 44, 44, 0.35);
    box-shadow: 0 12px 28px rgba(26, 26, 26, 0.12);
    outline: none;
}

.ai-doc-landing-demo .ai-doc-demo-sample.is-active {
    border-color: rgba(44, 44, 44, 0.55);
    box-shadow: 0 12px 28px rgba(26, 26, 26, 0.14);
}

.ai-doc-landing-demo .ai-doc-demo-sample-hint {
    position: absolute;
    top: 0.7rem;
    left: 0.7rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(44, 44, 44, 0.9);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.ai-doc-landing-demo .ai-doc-demo-sample-media {
    flex: 1 1 auto;
    min-height: 16.5rem;
    background: #f4f2ef;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
}

.ai-doc-landing-demo .ai-doc-demo-sample img {
    display: block;
    width: 100%;
    height: 16.5rem;
    object-fit: cover;
    object-position: top center;
}

.ai-doc-landing-demo .ai-doc-demo-sample-caption {
    display: block;
    padding: 0.7rem 0.85rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--ai-doc-demo-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    border-top: 1px solid rgba(26, 26, 26, 0.06);
}

@media (max-width: 900px) {
    .ai-doc-landing-demo {
        --ai-doc-demo-panel-height: 28rem;
    }

    .ai-doc-landing-demo .tool-panels {
        grid-template-columns: 1fr;
    }

    .ai-doc-landing-demo .ai-doc-demo-sample-media,
    .ai-doc-landing-demo .ai-doc-demo-sample img {
        height: 14rem;
        min-height: 14rem;
    }
}

@media (max-width: 560px) {
    .ai-doc-landing-demo {
        --ai-doc-demo-panel-height: 26rem;
    }

    .ai-doc-landing-demo .panel-title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-doc-landing-demo .result-toolbar {
        justify-content: stretch;
    }

    .ai-doc-landing-demo .result-toolbar .action-button,
    .ai-doc-landing-demo .panel-header-action {
        width: 100%;
        text-align: center;
    }

    .ai-doc-landing-demo .ai-doc-demo-samples {
        grid-template-columns: 1fr;
    }

    .ai-doc-landing-demo .ai-doc-demo-sample-media,
    .ai-doc-landing-demo .ai-doc-demo-sample img {
        height: 15rem;
        min-height: 15rem;
    }
}
