
/* ============================================
   Share Modal
   ============================================ */

.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: shareModalFadeIn 0.2s ease;
}

@keyframes shareModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    overflow: hidden;
    animation: shareModalSlideIn 0.25s ease;
}

@keyframes shareModalSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.share-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.share-modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.share-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.share-modal-body {
    padding: 1.25rem;
}

.share-modal-hint {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.share-modal-url-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.share-modal-url {
    flex: 1;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    min-width: 0;
}

.share-modal-url:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.share-modal-copy {
    white-space: nowrap;
    flex-shrink: 0;
}

.share-modal-note {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Share button in header */
#share-btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .share-modal-url-wrapper {
        flex-direction: column;
    }
    .share-modal-url {
        font-size: 0.75rem;
    }
}

/* ============================================
   Embed Code Modal
   ============================================ */

.embed-modal-dialog {
    max-width: 680px;
}

.embed-options {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.embed-option-row {
    margin-bottom: 0.75rem;
}

.embed-option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.embed-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.embed-dimensions {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    transition: opacity var(--transition);
}

.embed-dim-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.embed-dim-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 40px;
}

.embed-dim-input {
    width: 70px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    text-align: center;
}

.embed-dim-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.embed-dim-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.embed-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.embed-preset-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.embed-preset-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.embed-preset-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.embed-preview-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.embed-preview {
    width: 100%;
    min-height: 180px;
    max-height: 320px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.embed-preview-frame-wrapper {
    border-radius: 6px;
    overflow: hidden;
}

.embed-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.embed-code-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.embed-code-textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    line-height: 1.5;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    resize: vertical;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.embed-code-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.embed-copy-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.embed-options code {
    font-size: 0.8rem;
    background: var(--bg-secondary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    color: var(--accent);
}

/* Embed mode — compact UI when loaded in an iframe */
html.embed-mode .header,
html.embed-mode .footer,
html.embed-mode .data-table-section,
html.embed-mode .transform-toggle-bar,
html.embed-mode .transform-panel,
html.embed-mode .recommendation-banner,
html.embed-mode .controls-bar,
html.embed-mode #chart-title-bar {
    display: none !important;
}

html.embed-mode .chart-panel {
    padding: 0 !important;
}

html.embed-mode .chart-container {
    border-radius: 0;
    box-shadow: none;
}

html.embed-mode main {
    padding: 0;
    min-height: 100vh;
}

html.embed-mode body {
    overflow: hidden;
}

@media (max-width: 768px) {
    .embed-dimensions {
        flex-direction: column;
        gap: 0.5rem;
    }
    .embed-presets {
        gap: 0.35rem;
    }
    .embed-preview {
        min-height: 120px;
        max-height: 200px;
    }
    .embed-modal-dialog {
        max-width: 95%;
    }
}
