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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.6;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  margin: 0;
  border-radius: 0;
}

header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: relative;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo-section h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  background: linear-gradient(45deg, #ffffff, #e3f2fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  font-weight: 400;
}

.version {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
  gap: 0;
}

.editor-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  min-width: 300px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
  z-index: 2;
}

.panel-header {
  padding: 1rem 1.5rem 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  color: #475569;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.diagram-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 300px;
  background: #ffffff;
}

.resizer {
  width: 6px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  cursor: col-resize;
  position: relative;
  transition: all 0.3s ease;
  border-left: 1px solid #f1f5f9;
  border-right: 1px solid #f1f5f9;
}

.resizer:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  width: 8px;
}

.resizer:active {
  background-color: #2980b9;
}

.resizer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -2px;
  right: -2px;
  bottom: 0;
  /* Invisible wider hit area for easier grabbing */
}

/* Prevent text selection during resize */
.resizing {
  user-select: none;
}

.resizing * {
  pointer-events: none;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 1rem;
}

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

.toolbar-info {
  display: flex;
  align-items: center;
}

.hint {
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
}

.btn {
  padding: 0.6rem 1.2rem;
  border: 2px solid transparent;
  background: #f1f5f9;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border-color: #3b82f6;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-color: #10b981;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  border-color: #64748b;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
}

.filename-input {
  padding: 0.6rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.3s ease;
  min-width: 180px;
}

.filename-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.theme-selector-wrapper {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.5rem 1rem;
  margin-right: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.theme-selector-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.theme-selector-wrapper:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.theme-selector-wrapper:hover::before {
  opacity: 1;
}

.theme-label {
  font-weight: 600;
  color: #475569;
  font-size: 0.8rem;
  margin-right: 0.75rem;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.theme-select {
  border: none;
  background: transparent;
  color: #1e293b;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  min-width: 130px;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.theme-select:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.1);
}

.theme-select option {
  background: #ffffff;
  color: #1e293b;
  padding: 0.5rem;
  font-weight: 500;
}



.editor {
  flex: 1;
  padding: 1.5rem;
  border: none;
  font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;
  font-size: 0.9rem;
  resize: none;
  line-height: 1.6;
  overflow: auto;
  white-space: pre;
  background: #ffffff;
  color: #1e293b;
  transition: all 0.3s ease;
}

.editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.editor::placeholder {
  color: #94a3b8;
  font-style: italic;
}

.diagram-container {
  flex: 1;
  overflow: auto;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 0;
  padding: 2rem;
  text-align: center;
  margin: 0;
  position: relative;
}

.diagram-container svg {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: transform 0.2s ease;
}

.diagram-container svg:hover {
  transform: scale(1.02);
}

.notification {
  position: fixed;
  top: 30px;
  right: 30px;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  opacity: 0;
  transform: translateX(100%) scale(0.8);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-width: 250px;
}

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

.notification.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Professional scrollbars */
.editor::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.editor::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.editor::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  border-radius: 4px;
}

.editor::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

/* Loading states */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Focus styles for accessibility */
.btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .main-content {
    flex-direction: column;
  }

  .editor-panel {
    border-right: none;
    border-bottom: 1px solid #ddd;
  }

  .filename-input {
    max-width: 100%;
  }
}