:root {
    /* Modern Gradient Theme */
    --royal-primary: #6366f1;
    --royal-secondary: #8b5cf6;
    --royal-accent: #ec4899;
    --royal-light: #ddd6fe;
    --royal-dark: #312e81;
    --gold: #f59e0b;
    --silver: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --background: #f9fafb;
    --card-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease;
    --border-radius: 12px;
    --sidebar-width: 70px;
    --sidebar-expanded: 220px;
    --header-height: 64px;
    --toolbar-height: 56px;
    --right-panel-width: 300px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: #fbbf24;
    animation: pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.5));
}

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

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-item.active {
    background-color: var(--royal-accent);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #ffa000);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--royal-dark);
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    transform: scale(1.1);
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar.expanded {
    width: var(--sidebar-expanded);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    margin: 0 auto 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.tool-group {
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.tool-group-title {
    color: var(--royal-light);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.sidebar.expanded .tool-group-title {
    opacity: 0.7;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
    font-size: 0.85rem;
}

.tool-btn i {
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
}

.tool-btn span {
    opacity: 0;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar.expanded .tool-btn span {
    opacity: 1;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.tool-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateX(2px);
}

.tooltip {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-left: 10px;
}

.sidebar:not(.expanded) .tool-btn:hover .tooltip {
    opacity: 1;
}

/* Content Area */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Toolbar */
.toolbar {
    background-color: var(--card-bg);
    padding: 0.5rem 1rem;
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow);
    flex-wrap: nowrap;
    overflow-x: auto;
}

.toolbar::-webkit-scrollbar {
    height: 4px;
}

.toolbar::-webkit-scrollbar-thumb {
    background: var(--silver);
    border-radius: 2px;
}

.toolbar-group {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.toolbar-btn {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
    font-size: 0.85rem;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background-color: var(--royal-light);
    border-color: var(--royal-light);
}

.toolbar-btn.active {
    background-color: var(--royal-primary);
    color: white;
    border-color: var(--royal-primary);
}

.toolbar-btn i {
    font-size: 0.9rem;
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    background-color: var(--silver);
    flex-shrink: 0;
}

.style-controls {
    display: flex;
    gap: 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.control-group label {
    color: var(--text-secondary);
}

.slider {
    width: 60px;
    cursor: pointer;
}

.slider-value {
    min-width: 20px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.color-picker {
    width: 28px;
    height: 28px;
    border: 2px solid var(--silver);
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border-radius: 2px;
    border: none;
}

/* Graph Container */
.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 35px, rgba(0, 0, 0, 0.03) 35px, rgba(0, 0, 0, 0.03) 36px),
        repeating-linear-gradient(90deg, transparent, transparent 35px, rgba(0, 0, 0, 0.03) 35px, rgba(0, 0, 0, 0.03) 36px);
}

.graph-wrapper {
    position: relative;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#graphCanvas {
    background-color: white;
    display: block;
}

/* Coordinate Display */
.coordinate-display {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    display: flex;
    gap: 1rem;
    z-index: 10;
}

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

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
}

.zoom-btn:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.zoom-level {
    background-color: var(--card-bg);
    padding: 0.4rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: var(--shadow);
    text-align: center;
}

/* Mini Map */
.mini-map {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 10;
}

#miniMapCanvas {
    display: block;
}

.mini-map-viewport {
    position: absolute;
    border: 2px solid var(--royal-accent);
    background-color: rgba(124, 77, 255, 0.2);
    pointer-events: none;
}

/* Right Panel */
.right-panel {
    width: var(--right-panel-width);
    background-color: var(--card-bg);
    border-left: 1px solid var(--silver);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.right-panel.collapsed {
    transform: translateX(100%);
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--silver);
}

.panel-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.panel-tab:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.03);
}

.panel-tab.active {
    color: var(--royal-primary);
    border-bottom-color: var(--royal-primary);
    font-weight: 500;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: none;
}

.panel-content.active {
    display: block;
}

.property-section {
    margin-bottom: 1.5rem;
}

.property-section h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.property-row label {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.property-row input[type="number"],
.property-row input[type="text"] {
    width: 80px;
    padding: 0.4rem;
    border: 1px solid var(--silver);
    border-radius: 4px;
    font-size: 0.85rem;
}

.property-row input[type="color"] {
    width: 40px;
    height: 28px;
}

.property-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Layers */
.layers-actions {
    margin-bottom: 1rem;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 0.6rem;
    background-color: var(--background);
    border-radius: var(--border-radius);
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.layer-item:hover {
    background-color: var(--royal-light);
}

.layer-item.active {
    background-color: var(--royal-light);
    border-left: 3px solid var(--royal-primary);
}

.layer-visibility {
    cursor: pointer;
}

.layer-name {
    flex: 1;
    font-size: 0.85rem;
}

.layer-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

.layer-actions button:hover {
    color: var(--royal-primary);
}

/* History */
.history-actions {
    margin-bottom: 1rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-item {
    padding: 0.5rem;
    font-size: 0.8rem;
    background-color: var(--background);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-item:hover {
    background-color: var(--royal-light);
}

.history-item.active {
    background-color: var(--royal-light);
    font-weight: 500;
}

.history-item i {
    color: var(--text-secondary);
}

/* Floating Panel */
.floating-panel {
    position: absolute;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.floating-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--silver);
}

.floating-panel .panel-header h3 {
    font-size: 0.95rem;
    font-weight: 500;
}

.floating-panel .panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
}

/* Shape Selector */
.shape-selector {
    left: 80px;
    top: 100px;
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 1rem;
}

.shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem;
    background: var(--background);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.shape-btn:hover {
    background-color: var(--royal-light);
    border-color: var(--royal-primary);
}

.shape-btn.selected {
    background-color: var(--royal-light);
    border-color: var(--royal-primary);
}

.shape-btn i {
    font-size: 1.5rem;
    color: var(--royal-primary);
}

.shape-btn span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-large {
    max-width: 800px;
}

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

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

.modal-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    color: var(--royal-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--silver);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--silver);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--royal-primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--silver);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Export Formats */
.export-formats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.radio-card {
    cursor: pointer;
}

.radio-card input {
    display: none;
}

.radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem;
    border: 2px solid var(--silver);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.radio-card input:checked + .radio-content {
    border-color: var(--royal-primary);
    background-color: var(--royal-light);
}

.radio-content i {
    font-size: 1.5rem;
    color: var(--royal-primary);
}

.radio-content span {
    font-size: 0.85rem;
}

/* Function Examples */
.function-examples {
    margin-top: 1rem;
}

.function-examples p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.3rem 0.75rem;
    background-color: var(--background);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.chip:hover {
    background-color: var(--royal-light);
    color: var(--royal-primary);
}

/* Text Style Buttons */
.text-style-btns {
    display: flex;
    gap: 0.25rem;
}

.style-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--silver);
    background: var(--card-bg);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.style-btn:hover {
    background-color: var(--royal-light);
}

.style-btn.active {
    background-color: var(--royal-primary);
    color: white;
    border-color: var(--royal-primary);
}

/* Help Content */
.help-content {
    max-height: 60vh;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    margin-bottom: 1rem;
    color: var(--royal-primary);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background-color: var(--background);
    border-radius: 4px;
    font-size: 0.85rem;
}

.shortcut kbd {
    background-color: var(--card-bg);
    border: 1px solid var(--silver);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.help-section ul {
    list-style: none;
}

.help-section li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--silver);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.gallery-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--silver);
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: var(--royal-primary);
}

.gallery-card-preview {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.gallery-card-info {
    padding: 1rem;
}

.gallery-card-info h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.gallery-card-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-card-info small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.gallery-card-actions {
    padding: 0 1rem 1rem;
    display: flex;
    gap: 0.5rem;
}

.gallery-item {
    background-color: var(--background);
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.gallery-thumbnail {
    width: 100%;
    height: 120px;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-thumbnail img {
    max-width: 100%;
    max-height: 100%;
}

.gallery-info {
    padding: 0.75rem;
}

.gallery-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.gallery-info small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.gallery-loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.gallery-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--royal-primary);
}

.gallery-empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.gallery-error {
    text-align: center;
    padding: 3rem;
    color: var(--error);
    font-size: 1.1rem;
}

.btn-danger {
    background-color: var(--error);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: #1f2937;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 3000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background-color: var(--success);
}

.toast.error {
    background-color: var(--error);
}

.toast.warning {
    background-color: var(--warning);
}

.toast.info {
    background-color: var(--info);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    background-color: var(--card-bg);
    padding: 2rem 3rem;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--royal-primary);
}

/* Dark Mode */
body.dark-mode {
    --background: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --silver: #444;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .header {
    background: linear-gradient(135deg, #000051, #0d1137);
}

body.dark-mode .toolbar,
body.dark-mode .right-panel {
    background-color: var(--card-bg);
    border-color: var(--silver);
}

body.dark-mode .modal-content {
    background-color: var(--card-bg);
}

body.dark-mode .form-control {
    background-color: #2a2a2a;
    border-color: var(--silver);
    color: var(--text-primary);
}

body.dark-mode .graph-container {
    background-color: #2a2a2a;
}

body.dark-mode #graphCanvas {
    background-color: #1e1e1e;
}

body.dark-mode .shape-btn,
body.dark-mode .history-item,
body.dark-mode .layer-item {
    background-color: #2a2a2a;
}

body.dark-mode .zoom-level {
    background-color: #2a2a2a;
    color: var(--text-primary);
}

body.dark-mode .mini-map {
    background-color: #2a2a2a;
}

body.dark-mode .coordinate-display {
    background-color: rgba(0, 0, 0, 0.9);
}

/* Responsive */
@media (max-width: 1024px) {
    .right-panel {
        position: absolute;
        right: 0;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        transform: translateX(100%);
        z-index: 200;
    }
    
    .right-panel.visible {
        transform: translateX(0);
    }
    
    .style-controls {
        display: none;
    }
    
    .mini-map {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        display: none;
    }
    
    .sidebar {
        width: 60px;
    }
    
    .sidebar.expanded {
        width: 180px;
    }
    
    .toolbar-btn span {
        display: none;
    }
    
    .coordinate-display {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .export-formats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Focus Styles */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--royal-accent);
    outline-offset: 2px;
}

button:focus:not(:focus-visible) {
    outline: none;
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .toolbar,
    .right-panel,
    .zoom-controls,
    .mini-map,
    .coordinate-display {
        display: none !important;
    }
    
    .main-container {
        display: block;
    }
    
    .content-area,
    .graph-container {
        position: static;
        width: 100%;
        height: auto;
    }
    
    #graphCanvas {
        max-width: 100%;
        height: auto;
    }
}
