/* ═══════════════════════════════════════════════════════════════════════════════
   MGraph HTML Graph - HTML Viewer Styles
   v0.2.11 - Component-specific styles
   ═══════════════════════════════════════════════════════════════════════════════ */

.html-viewer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--color-bg, #fff);
}

/* Toolbar */
.html-viewer-toolbar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    padding: var(--spacing-sm, 8px) var(--spacing-md, 16px);
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-bg-muted, #f9fafb);
    flex-shrink: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
}

.toolbar-center {
    flex: 1;
    text-align: center;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs, 4px);
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
}

.mode-btn {
    padding: var(--spacing-xs, 4px) var(--spacing-sm, 8px);
    border: none;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-right: 1px solid var(--color-border, #e5e7eb);
}

.mode-btn:last-child {
    border-right: none;
}

.mode-btn:hover {
    background: var(--color-bg-muted, #f3f4f6);
}

.mode-btn.active {
    background: var(--color-primary, #6366f1);
    color: white;
}

/* Viewer Info */
.viewer-info {
    font-size: 0.8rem;
    color: var(--color-text-secondary, #6b7280);
    font-family: var(--font-code, monospace);
}

/* Buttons */
.btn {
    padding: var(--spacing-xs, 4px) var(--spacing-sm, 8px);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-sm, 4px);
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
    background: var(--color-bg-muted, #f3f4f6);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-bg-muted, #f3f4f6);
}

.btn-success {
    background: var(--color-success, #10b981);
    color: white;
    border-color: var(--color-success, #10b981);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* Content Area */
.html-viewer-content {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* View Mode - Code Display */
.html-viewer-code {
    margin: 0;
    padding: var(--spacing-md, 16px);
    font-family: var(--font-code, 'Monaco', 'Menlo', monospace);
    font-size: 0.85rem;
    line-height: 1.5;
    background: #1e1e2e;
    color: #cdd6f4;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 100%;
}

/* Edit Mode - Textarea */
.html-editor-textarea {
    width: 100%;
    height: 100%;
    border: none;
    padding: var(--spacing-md, 16px);
    font-family: var(--font-code, 'Monaco', 'Menlo', monospace);
    font-size: 0.85rem;
    line-height: 1.5;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: none;
    outline: none;
}

.html-editor-textarea:focus {
    outline: none;
}

/* Preview Mode - iframe */
.html-viewer-preview {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Empty State */
.html-viewer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--color-text-muted, #9ca3af);
    text-align: center;
    padding: var(--spacing-md, 16px);
}

.html-viewer-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md, 16px);
    opacity: 0.3;
}

.html-viewer-empty p {
    margin: var(--spacing-xs, 4px) 0;
}

.html-viewer-empty .empty-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted, #9ca3af);
}

.html-viewer-empty .error-message {
    color: var(--color-error, #dc2626);
}

/* Spinner */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border, #e5e7eb);
    border-top-color: var(--color-primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--spacing-md, 16px);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
