/* Custom Styles for Mermaid Live Editor */

/* CodeMirror Custom Styling */
.CodeMirror {
  height: 100%;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  line-height: 1.6;
  border: none;
}

.CodeMirror-scroll {
  overflow: auto !important;
}

.CodeMirror-gutters {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.CodeMirror-linenumber {
  color: #94a3b8;
  padding: 0 8px;
}

.CodeMirror-cursor {
  border-left: 2px solid #6366f1;
}

.CodeMirror-selected {
  background: #e0e7ff !important;
}

.CodeMirror-focused .CodeMirror-selected {
  background: #c7d2fe !important;
}

/* Resizer Styling */
.resizer {
  width: 4px;
  background: linear-gradient(to right, #e2e8f0, #cbd5e1, #e2e8f0);
  cursor: col-resize;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.resizer:hover {
  background: linear-gradient(to right, #6366f1, #8b5cf6, #6366f1);
  width: 6px;
}

.resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 40px;
  background: rgba(100, 116, 139, 0.3);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.resizer:hover::after {
  opacity: 1;
  background: rgba(255, 255, 255, 0.9);
}

/* Preview Container */
.preview-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  cursor: grab;
  position: relative;
  background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
}

.preview-container:active {
  cursor: grabbing;
}

.preview-content {
  transform-origin: 0 0;
  transition: transform 0.1s ease;
  padding: 2rem;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar Transitions */
.sidebar {
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}

.sidebar.collapsed {
  margin-left: -256px; /* -w-64 (16rem = 256px) */
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
  }

  .sidebar.collapsed {
    margin-left: -256px;
  }
}

@media (min-width: 769px) {
  .sidebar {
    position: relative;
  }
}

/* Button Hover Effects */
.btn-primary {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  pointer-events: none;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

/* Ensure tooltips (title attribute) are visible */
button[title] {
  position: relative;
}

/* Zoom Controls */
.zoom-controls {
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Custom Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Mermaid Diagram Styling */
.mermaid {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Input Focus Styling */
input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Glassmorphism Effects */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Loading Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Responsive Design Helpers */
@media (max-width: 768px) {
  .CodeMirror {
    font-size: 12px;
  }

  .preview-content {
    padding: 1rem;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .header,
  .zoom-controls,
  .resizer {
    display: none !important;
  }

  .preview-content {
    padding: 0;
  }
}
