/* Marimo embed styles */
.marimo-embed {
    margin: 1.5rem 0;
    position: relative;
}

.marimo-embed iframe {
    display: block;
    max-width: 100%;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.marimo-embed iframe:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.marimo-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: system-ui, -apple-system, sans-serif;
    color: #666;
    font-size: 14px;
}

.marimo-loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: marimo-spin 1s linear infinite;
}

@keyframes marimo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.marimo-error {
    padding: 1rem;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c00;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

/* Compact mode styles */
.marimo-compact {
    min-height: auto !important;
    height: auto !important;
}

.marimo-compact-button {
    transition: all 0.3s ease;
}

.marimo-compact-button:hover {
    background: #e9ecef !important;
}

.marimo-compact-button .marimo-notebook-title {
    transition: opacity 0.3s ease;
}

.marimo-compact.marimo-loading-notebook .marimo-compact-button {
    opacity: 0.8;
    pointer-events: none;
}

.marimo-expanding {
    animation: pulse 0.6s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.98); }
}

/* Click-to-load styles */
.marimo-click-overlay {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: background 0.3s ease;
}

.marimo-click-overlay:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.marimo-load-button {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.marimo-load-button:hover {
    background: #0056b3 !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    transform: translateY(-2px);
}

.marimo-load-button:active {
    transform: translateY(0);
}

/* Loading state for click-to-load */
.marimo-embed.marimo-loading-notebook .marimo-click-overlay {
    pointer-events: none;
}

.marimo-embed.marimo-loading-notebook .marimo-load-button {
    opacity: 0.7;
}

.marimo-embed.marimo-loading-notebook .marimo-load-button::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: marimo-spin 1s linear infinite;
    vertical-align: middle;
}

.marimo-embed.marimo-loading-notebook .marimo-load-button span {
    display: none;
}

@media (max-width: 768px) {
    .marimo-load-button {
        font-size: 14px;
        padding: 10px 20px;
    }
}

@media (prefers-color-scheme: dark) {
    .marimo-embed[data-theme="auto"] iframe {
        background: #1a1a1a;
    }

    .marimo-click-overlay {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    }

    .marimo-click-overlay:hover {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
}
