/* CSS Variables for Theme Support */
:root {
    /* Light Theme (Default) */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --container-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e1e5e9;
    --border-light: #f0f0f0;
    --input-bg: #ffffff;
    --input-border: #e1e5e9;
    --input-focus: #007bff;
    --button-primary: #007bff;
    --button-primary-hover: #0056b3;
    --button-secondary: #6c757d;
    --button-copy: #28a745;
    --button-copy-hover: #218838;
    --button-export: #17a2b8;
    --button-export-hover: #138496;
    --button-regenerate: #fd7e14;
    --button-regenerate-hover: #e66c0a;
    --panel-bg: #ffffff;
    --panel-header-bg: #f8f9fa;
    --diagram-bg: #fafafa;
    --line-numbers-bg: #f8f9fa;
    --line-numbers-color: #6c757d;
    --textarea-bg: transparent;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --container-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #3d3d3d;
    --border-light: #2d2d2d;
    --input-bg: #2d2d2d;
    --input-border: #3d3d3d;
    --input-focus: #4dabf7;
    --button-primary: #4dabf7;
    --button-primary-hover: #339af0;
    --button-secondary: #868e96;
    --button-copy: #51cf66;
    --button-copy-hover: #40c057;
    --button-export: #22b8cf;
    --button-export-hover: #15aabf;
    --button-regenerate: #ff8c42;
    --button-regenerate-hover: #fd7e14;
    --panel-bg: #2d2d2d;
    --panel-header-bg: #3d3d3d;
    --diagram-bg: #2d2d2d;
    --line-numbers-bg: #000000;
    --line-numbers-color: #909090;
    --textarea-bg: transparent;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --success-color: #51cf66;
    --error-color: #ff6b6b;
    --warning-color: #ffd43b;
    --info-color: #22b8cf;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    transition: all 0.3s ease;
    /* Prevent iOS zoom on input focus */
    -webkit-text-size-adjust: 100%;
    /* Better touch scrolling on iOS */
    -webkit-overflow-scrolling: touch;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 30px;
    color: white;
    position: relative;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    width: 100%;
}

.header-text {
    text-align: center;
    flex-grow: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    position: absolute;
    top: 0;
    right: 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Theme Toggle Styles */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-toggle input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.theme-toggle input:checked + .toggle-slider {
    background: var(--button-primary);
}

.theme-toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        justify-content: center;
    }
    
    .header-text {
        text-align: center;
        order: 2;
        width: 100%;
    }
    
    .header-controls {
        order: 1;
        position: static;
        align-self: center;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }
    
    header p {
        font-size: 1rem;
    }
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-wrapper label {
    background: var(--button-primary);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.file-input-wrapper label:hover {
    background: var(--button-primary-hover);
    box-shadow: 0 3px 6px var(--shadow-medium);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.btn:focus,
.file-input-wrapper label:focus {
    outline: 2px solid var(--input-focus);
    outline-offset: 2px;
}

.btn:active,
.file-input-wrapper label:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px var(--shadow-light);
}

.btn-copy {
    background: var(--button-copy);
    color: white;
}

.btn-copy:hover {
    background: var(--button-copy-hover);
    box-shadow: 0 3px 6px var(--shadow-medium);
}


.error {
    background: #ff6b6b;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
    font-weight: 500;
    text-align: center;
}

.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 600px;
}

@media (max-width: 1024px) {
    .content {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .panel {
        padding: 16px;
    }
    
    .diagram-controls {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .panel-header h3 {
        margin-bottom: 0;
    }
}

.panel {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--shadow-light);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.panel h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.diagram-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-toggle {
    background: var(--panel-header-bg);
    color: var(--text-primary);
    padding: 8px 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-toggle:hover {
    background: var(--border-light);
    border-color: var(--input-focus);
}

.btn-toggle:focus,
.btn-export:focus,
.btn-fullscreen:focus,
.btn-regenerate:focus {
    outline: 2px solid var(--input-focus);
    outline-offset: 2px;
}

.btn-toggle:active,
.btn-export:active,
.btn-fullscreen:active,
.btn-regenerate:active {
    transform: translateY(1px);
}

.btn-export {
    background: var(--button-export);
    color: white;
    padding: 8px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-export:hover {
    background: var(--button-export-hover);
}

.btn-fullscreen {
    background: #6f42c1;
    color: white;
    padding: 8px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-fullscreen:hover {
    background: #5a32a3;
}

.btn-regenerate {
    background: var(--button-regenerate);
    color: white;
    padding: 8px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: none; /* Hidden by default */
}

.btn-regenerate:hover {
    background: var(--button-regenerate-hover);
}

.btn-regenerate.show {
    display: inline-block;
}

/* Modified indicator */
.modified-indicator {
    color: #fd7e14;
    font-size: 0.7rem;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    vertical-align: super;
}

.modified-indicator.show {
    opacity: 1;
}

/* Drag & Drop Zone Styles */
.drop-zone {
    position: absolute;
    top: 45px;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed #45b7d1;
    border-radius: 8px;
    background: rgba(69, 183, 209, 0.05);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: none; /* Don't block events when hidden */
}

.drop-zone.drag-over {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    transform: scale(1.02);
    pointer-events: auto; /* Enable events when active */
}

/* When drop zone is shown */
.drop-zone[style*="flex"] {
    pointer-events: auto;
}

.drop-zone-content {
    text-align: center;
    color: #45b7d1;
    pointer-events: none;
    position: relative;
}

.drop-zone-file-action {
    display: inline-block;
    padding: 16px 24px;
    background: rgba(69, 183, 209, 0.1);
    border: 2px solid #45b7d1;
    border-radius: 8px;
    margin-top: 16px;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.drop-zone-file-action:hover {
    background: rgba(69, 183, 209, 0.2);
    transform: translateY(-2px);
}

.drop-zone-click-hint {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    opacity: 0.6;
    pointer-events: none;
}

.drop-zone-icon {
    margin-bottom: 16px;
    opacity: 0.7;
}

.drop-zone-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px;
    margin-top: 0;
}

.drop-zone-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
}

/* Code panel positioning for drop zone */
.code-panel {
    position: relative;
}

/* Syntax highlighting controls */
.code-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.syntax-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.syntax-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #45b7d1;
}

.toggle-text {
    color: #666;
    user-select: none;
}

/* Code editor container */
.code-editor-container {
    position: relative;
    flex: 1;
    min-height: 500px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    overflow: hidden;
}

/* Monaco Editor wrapper */
.monaco-editor-wrapper {
    width: 100%;
    height: 500px;
    min-height: 500px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.monaco-editor-wrapper.syntax-disabled {
    display: none;
}

/* Monaco Editor specific dark theme styling */
[data-theme="dark"] .monaco-editor-wrapper {
    background: #0d1117;
    border-color: var(--border-color);
}

/* Ensure Monaco editor respects the GitHub dark theme */
[data-theme="dark"] .monaco-editor .margin,
[data-theme="dark"] .monaco-editor .monaco-editor-background,
[data-theme="dark"] .monaco-editor-wrapper .monaco-editor {
    background: #0d1117 !important;
    color: #e6edf3 !important;
}

/* GitHub-like dark theme improvements for Monaco */
[data-theme="dark"] .monaco-editor .current-line,
[data-theme="dark"] .monaco-editor .view-line {
    background: transparent !important;
}

[data-theme="dark"] .monaco-editor .selected-text {
    background: #264f78 !important;
}

/* Syntax highlighting enhancements for dark theme */
[data-theme="dark"] .monaco-editor .mtk1 { color: #e6edf3 !important; } /* Default text */
[data-theme="dark"] .monaco-editor .mtk2 { color: #8b949e !important; } /* Comments */
[data-theme="dark"] .monaco-editor .mtk3 { color: #79c0ff !important; } /* Keywords */
[data-theme="dark"] .monaco-editor .mtk4 { color: #a5d6ff !important; } /* Strings */
[data-theme="dark"] .monaco-editor .mtk5 { color: #79c0ff !important; } /* Numbers */
[data-theme="dark"] .monaco-editor .mtk6 { color: #ffa657 !important; } /* Types */


/* Textarea Editor with Line Numbers */
.textarea-editor-wrapper {
    display: flex;
    width: 100%;
    height: 500px;
    min-height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--input-bg);
    position: relative;
    transition: all 0.3s ease;
}

.line-numbers {
    min-width: 60px;
    width: 60px;
    padding: 0 8px 0 0;
    background: var(--line-numbers-bg);
    border-right: 1px solid var(--border-color);
    color: var(--line-numbers-color);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 20px;
    text-align: right;
    user-select: none;
    white-space: pre;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.textarea-editor-wrapper #codeInput {
    flex: 1;
    border: none;
    outline: none;
    padding: 0;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 20px;
    resize: none;
    background: var(--textarea-bg);
    color: var(--text-primary);
    white-space: pre;
    overflow-wrap: normal;
    tab-size: 2;
}

#codeInput {
    width: 100%;
    height: 500px;
    border: none;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    background: white;
    outline: none;
    tab-size: 4;
}

#codeInput:focus {
    outline: 2px solid #45b7d1;
    outline-offset: -2px;
}

#mermaidOutput {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
    transition: all 0.3s ease;
    min-height: 500px;
    background: var(--input-bg);
    color: var(--text-primary);
}

#codeInput:focus {
    outline: none;
    border-color: #45b7d1;
}

#mermaidOutput {
    resize: none;
}

#mermaidOutput:focus {
    outline: none;
    border-color: var(--button-regenerate);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(253, 126, 20, 0.1);
}

/* Dark theme support for focused state */
[data-theme="dark"] #mermaidOutput:focus {
    background: var(--input-bg) !important;
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.2);
}

#mermaidOutput.modified {
    border-left: 4px solid var(--button-regenerate);
}

/* Dark theme support for Mermaid output textarea */
[data-theme="dark"] #mermaidOutput {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Dark theme support for modified state */
[data-theme="dark"] #mermaidOutput.modified {
    background: rgba(255, 140, 66, 0.1) !important;
    color: var(--text-primary) !important;
}

[data-theme="light"] #mermaidOutput.modified {
    background: #fff9f5;
}

.mermaid-source {
    display: none;
}

/* Dark theme support for mermaid source when visible */
[data-theme="dark"] .mermaid-source {
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.diagram-display {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    background: var(--diagram-bg);
    overflow: auto;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.placeholder-text {
    color: #666;
    font-style: italic;
    text-align: center;
}

.error-text {
    color: #ff6b6b;
    font-weight: 500;
    text-align: center;
    padding: 20px;
}

/* Mermaid diagram styling */
.diagram-display .mermaid {
    width: 100%;
    text-align: center;
}

.diagram-display svg {
    max-width: 100%;
    height: auto;
    background: var(--diagram-bg);
    border-radius: 4px;
}

/* Dark theme support for Mermaid diagrams */
[data-theme="dark"] .diagram-display svg {
    background: var(--diagram-bg) !important;
}

/* Override Mermaid's default white background in dark mode */
[data-theme="dark"] .diagram-display svg rect.background,
[data-theme="dark"] .diagram-display svg .background {
    fill: var(--diagram-bg) !important;
}

/* Ensure text is visible in dark mode */
[data-theme="dark"] .diagram-display svg text {
    fill: var(--text-primary) !important;
}

/* Fix node backgrounds in dark mode */
[data-theme="dark"] .diagram-display svg .node rect,
[data-theme="dark"] .diagram-display svg .node polygon,
[data-theme="dark"] .diagram-display svg .node circle {
    stroke: var(--border-color) !important;
}

/* Fix edge labels background in dark mode */
[data-theme="dark"] .diagram-display svg .edgeLabel rect {
    fill: var(--diagram-bg) !important;
    stroke: none !important;
}

/* Enhanced styling for extreme PNG export quality */
.diagram-display svg text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 500;
    text-rendering: optimizeLegibility;
    font-smooth: always;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.diagram-display svg .nodeLabel {
    font-size: 16px !important; /* Increased for extreme quality */
    font-weight: 700 !important; /* Bolder for better readability */
    text-rendering: optimizeLegibility;
}

.diagram-display svg .edgeLabel {
    font-size: 14px !important; /* Increased for extreme quality */
    font-weight: 600 !important; /* Bolder for better readability */
    text-rendering: optimizeLegibility;
}

/* Hide background rectangles for edge labels in Mermaid v11 */
.diagram-display svg .edgeLabel rect {
    fill: none !important;
    stroke: none !important;
    opacity: 0 !important;
}

/* Style edge label text directly */
.diagram-display svg .edgeLabel text {
    font-size: 14px !important;
    font-weight: 600 !important;
    text-rendering: optimizeLegibility;
}

/* Dark theme edge label text */
[data-theme="dark"] .diagram-display svg .edgeLabel text {
    fill: var(--text-primary) !important;
}

[data-theme="light"] .diagram-display svg .edgeLabel text {
    fill: #333 !important;
}

/* Additional extreme quality enhancements */
.diagram-display svg {
    shape-rendering: geometricPrecision;
    text-rendering: optimizeLegibility;
}

.diagram-display svg path {
    stroke-width: 2px; /* Slightly thicker lines for better visibility */
}

.diagram-display svg rect {
    stroke-width: 2px; /* Thicker borders for nodes */
}

/* Responsive design */
/* Small mobile devices (iPhone) */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .content {
        gap: 15px;
    }
    
    .panel {
        padding: 12px;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .diagram-controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .btn-toggle,
    .btn-export,
    .btn-fullscreen,
    .btn-regenerate {
        padding: 10px 14px;
        font-size: 0.9rem;
        min-height: 44px; /* Apple's recommended touch target */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
    }
    
    .btn,
    .file-input-wrapper label {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    /* Monaco Editor adjustments for mobile */
    .monaco-editor-wrapper,
    .textarea-editor-wrapper {
        min-height: 250px;
    }
    
    /* Diagram container mobile optimization */
    .diagram-display {
        min-height: 300px;
        /* Better touch scrolling */
        -webkit-overflow-scrolling: touch;
        overflow: auto;
    }
    
    /* Touch-friendly drag and drop zone */
    .drop-zone {
        min-height: 150px;
        padding: 20px;
    }
    
    .drop-zone-content {
        padding: 16px;
    }
    
    .drop-zone-text {
        font-size: 1.1rem;
    }
    
    .drop-zone-file-action {
        padding: 12px 20px;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile-friendly theme toggle */
    .theme-toggle {
        padding: 10px 14px;
        min-height: 44px;
    }
    
    .toggle-label {
        font-size: 1rem;
    }
    
    /* Better textarea and input sizing */
    #codeInput, 
    #mermaidOutput {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.4;
        padding: 16px;
    }
    
    /* Fullscreen modal improvements */
    .fullscreen-modal {
        padding: 10px;
    }
    
    .zoom-controls {
        bottom: 80px; /* Account for mobile browser bars */
    }
    
    .zoom-btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    #codeInput, #mermaidOutput {
        min-height: 300px;
    }
}

/* Fullscreen modal styles */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.fullscreen-content {
    width: 95%;
    max-width: 1400px;
    min-height: 90vh;
    background: var(--container-bg);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    box-sizing: border-box;
    margin: auto;
    transition: all 0.3s ease;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e5e9;
}

.zoom-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.zoom-info span {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #495057;
}

.fullscreen-close {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.fullscreen-close:hover {
    background: #c82333;
}

.fullscreen-diagram {
    width: 100%;
    min-height: calc(90vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: visible;
    padding: 10px 0;
}

.fullscreen-diagram .mermaid {
    width: 100%;
    text-align: center;
}

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.zoom-btn:hover {
    background: white;
    border-color: #45b7d1;
    color: #45b7d1;
    transform: scale(1.05);
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* Zoom Container */
.zoom-container {
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 0.3s ease;
    cursor: grab;
    position: relative;
    min-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.zoom-container.dragging {
    cursor: grabbing;
    transition: none;
}

.zoom-container .mermaid {
    width: auto;
    max-width: none;
    text-align: center;
}

.zoom-container svg {
    max-width: none;
    height: auto;
}

/* Update fullscreen diagram to allow overflow */
.fullscreen-diagram {
    width: 100%;
    min-height: calc(90vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    padding: 10px 0;
    position: relative;
}

/* Mobile zoom controls */
@media (max-width: 768px) {
    .zoom-controls {
        position: fixed;
        top: auto;
        bottom: 20px;
        right: 20px;
        flex-direction: row;
        background: rgba(255, 255, 255, 0.9);
        padding: 8px;
        border-radius: 12px;
        backdrop-filter: blur(10px);
    }
    
    .zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* Toast Notifications System */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #45b7d1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(400px);
    opacity: 0;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin: 0;
}

.toast-message {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

/* Toast types */
.toast.success {
    border-left-color: #28a745;
}

.toast.success .toast-icon {
    background: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.error .toast-icon {
    background: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

.toast.warning .toast-icon {
    background: #ffc107;
    color: #333;
}

.toast.info {
    border-left-color: #17a2b8;
}

.toast.info .toast-icon {
    background: #17a2b8;
}

/* Toast progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0 0 8px 8px;
    transform-origin: left;
    animation: toast-progress 5s linear forwards;
}

.toast.success .toast-progress {
    background: #28a745;
}

.toast.error .toast-progress {
    background: #dc3545;
}

.toast.warning .toast-progress {
    background: #ffc107;
}

.toast.info .toast-progress {
    background: #17a2b8;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Mobile adaptations for toasts */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
    
    .toast.hide {
        transform: translateY(-100px);
    }
}