bookwiz.io / app / globals.css
globals.css
Raw
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    /* Prevent overscroll behavior (white space when scrolling past top/bottom) */
    overscroll-behavior: none;
  }
  
  * {
    box-sizing: border-box;
  }

  /* Prevent mobile zoom on input focus */
  input, textarea, select, [contenteditable] {
    font-size: 16px !important;
  }

  /* Prevent zoom on iOS Safari when focusing inputs */
  @media screen and (max-width: 768px) {
    input, textarea, select, [contenteditable] {
      font-size: 16px !important;
      transform: scale(1);
      transform-origin: left top;
    }
  }

  /* Improved scrollbar styling for modern look */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
  }

  /* Performance optimizations for smooth scrolling */
  
  /* Prevent overscroll in editor components */
  .tiptap-editor-container {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    /* Enable GPU acceleration for smoother scrolling */
    transform: translateZ(0);
    will-change: scroll-position;
  }
  
  .tiptap-editor-content {
    overscroll-behavior: none;
    /* Enable GPU acceleration for smoother scrolling */
    transform: translateZ(0);
    will-change: scroll-position;
  }
  
  /* Prevent overscroll in editor pages */
  .book-editor-page {
    overscroll-behavior: none;
  }
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Optimize transforms and animations */
  .transform-gpu {
    transform: translateZ(0);
  }

  /* Optimize chat scrolling */
  .chat-scroll {
    scroll-behavior: smooth;
    will-change: scroll-position;
    transform: translateZ(0);
  }

  /* Remove focus outline from chat input textarea */
  .chat-input textarea:focus,
  textarea.chat-input:focus,
  .chat-input textarea:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Prevent any focus styles on textareas globally */
  textarea:focus,
  textarea:focus-visible,
  textarea:focus-within {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    outline-offset: 0 !important;
    outline-style: none !important;
    outline-width: 0 !important;
  }
}

@layer components {
  .file-tree-item {
    @apply flex items-center px-2 py-1 text-sm cursor-pointer hover:bg-gray-700 transition-colors text-gray-200;
  }
  
  .file-tree-item.selected {
    @apply bg-blue-900/50 text-blue-300 border-l-2 border-blue-400;
  }

  /* Modern glassmorphism card */
  .glass-card {
    @apply bg-gray-900/40 backdrop-blur-sm border border-gray-800/50 rounded-2xl;
  }

  .glass-card:hover {
    @apply bg-gray-900/60 border-gray-700/50;
  }

  /* Modern button styles */
  .btn-primary {
    @apply inline-flex items-center px-6 py-3 text-sm font-medium text-white bg-gradient-to-r from-teal-500 to-cyan-500 hover:from-teal-600 hover:to-cyan-600 rounded-xl transition-all duration-200 shadow-lg hover:shadow-xl;
  }

  .btn-secondary {
    @apply inline-flex items-center px-4 py-2 text-sm font-medium text-gray-300 bg-gray-800/50 hover:bg-gray-800/80 border border-gray-700/50 hover:border-gray-600/50 rounded-lg transition-all duration-200 backdrop-blur-sm;
  }

  /* Text truncation utilities */
  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Custom animations */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

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

  @keyframes scaleIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

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

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

  .animate-scale-in {
    animation: scaleIn 0.3s ease-out;
  }

  /* Modern focus styles */
  .focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-teal-500/50 focus:border-teal-500/50;
  }

  /* Status indicators */
  .status-indicator {
    @apply px-3 py-1 text-xs font-medium rounded-full border backdrop-blur-sm;
  }

  .status-published {
    @apply bg-emerald-500/20 text-emerald-300 border-emerald-500/30;
  }

  .status-draft {
    @apply bg-amber-500/20 text-amber-300 border-amber-500/30;
  }

  .status-in-progress {
    @apply bg-blue-500/20 text-blue-300 border-blue-500/30;
  }

  .status-completed {
    @apply bg-purple-500/20 text-purple-300 border-purple-500/30;
  }
}

/* Tiptap Editor Styles */
.ProseMirror {
  outline: none;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #f1f5f9; /* slate-100 */
  /* Performance optimizations */
  transform: translateZ(0);
  /* Reduce repaints during scrolling */
  contain: layout style paint;
  /* Optimize text rendering */
  text-rendering: optimizeSpeed;
  -webkit-font-feature-settings: "liga" 0;
  font-feature-settings: "liga" 0;
}

/* Ensure TipTap editor doesn't zoom on mobile */
@media screen and (max-width: 768px) {
  .ProseMirror {
    font-size: 16px !important;
  }
  
  /* Ensure chat input doesn't zoom on mobile */
  .chat-input {
    font-size: 16px !important;
  }
  
  /* Ensure search inputs don't zoom on mobile */
  input[type="text"], input[type="search"] {
    font-size: 16px !important;
  }
  
  /* Ensure all input elements don't zoom on mobile */
  input, textarea, select, [contenteditable] {
    font-size: 16px !important;
  }
}

.ProseMirror h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem 0;
  color: #f8fafc; /* slate-50 */
  border-bottom: 2px solid #475569; /* slate-600 */
  padding-bottom: 0.5rem;
}

.ProseMirror h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem 0;
  color: #f8fafc; /* slate-50 */
}

.ProseMirror h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem 0;
  color: #f8fafc; /* slate-50 */
}

.ProseMirror h4,
.ProseMirror h5,
.ProseMirror h6 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0.75rem 0 0.5rem 0;
  color: #f8fafc; /* slate-50 */
}

.ProseMirror p {
  margin: 0.75rem 0;
  line-height: 1.7;
}

.ProseMirror ul,
.ProseMirror ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.ProseMirror ul li {
  list-style-type: disc;
  margin: 0.25rem 0;
}

.ProseMirror ol li {
  list-style-type: decimal;
  margin: 0.25rem 0;
}

.ProseMirror ul ul,
.ProseMirror ol ol,
.ProseMirror ul ol,
.ProseMirror ol ul {
  margin: 0.25rem 0;
}

.ProseMirror blockquote {
  border-left: 4px solid #64748b; /* slate-500 */
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #cbd5e1; /* slate-300 */
}

.ProseMirror pre {
  background-color: #1e293b; /* slate-800 */
  border-radius: 0.375rem;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875rem;
}

.ProseMirror code {
  background-color: #374151; /* slate-700 */
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875rem;
  color: #f1f5f9; /* slate-100 */
}

.ProseMirror pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

.ProseMirror strong {
  font-weight: 700;
  color: #f8fafc; /* slate-50 */
}

.ProseMirror em {
  font-style: italic;
  color: #e2e8f0; /* slate-200 */
}

.ProseMirror hr {
  border: none;
  border-top: 2px solid #475569; /* slate-600 */
  margin: 2rem 0;
}

/* Placeholder text */
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #64748b; /* slate-500 */
  pointer-events: none;
  height: 0;
}

/* Focus styles */
.ProseMirror:focus {
  outline: none;
}

/* Selection styles */
.ProseMirror ::selection {
  background-color: #334155; /* slate-700 */
}

/* Ensure proper spacing for nested lists */
.ProseMirror li p {
  margin: 0.25rem 0;
}

/* Task List styles */
.ProseMirror ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
}

.ProseMirror ul[data-type="taskList"] li {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.ProseMirror ul[data-type="taskList"] li > label {
  flex-shrink: 0;
  margin-right: 0.5rem;
  margin-top: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.ProseMirror ul[data-type="taskList"] li > label > input[type="checkbox"] {
  appearance: none;
  width: 1.15em;
  height: 1.15em;
  border: 2px solid #64748b; /* slate-500 */
  border-radius: 0.25rem;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
  vertical-align: middle;
  display: inline-block;
}

.ProseMirror ul[data-type="taskList"] li > label > input[type="checkbox"]:checked {
  background-color: #0f766e; /* teal-600 */
  border-color: #0f766e; /* teal-600 */
}

.ProseMirror ul[data-type="taskList"] li > label > input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
}

.ProseMirror ul[data-type="taskList"] li > div {
  flex: 1;
  min-width: 0;
}

.ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Table styles if needed */
.ProseMirror table {
  border-collapse: collapse;
  margin: 1rem 0;
  width: 100%;
  overflow: hidden;
  table-layout: fixed;
  border: 2px solid #475569; /* slate-600 */
  border-radius: 0.375rem;
}

.ProseMirror table td,
.ProseMirror table th {
  border: 1px solid #475569; /* slate-600 */
  padding: 0.75rem;
  text-align: left;
  vertical-align: top;
  position: relative;
  background-color: #1e293b; /* slate-800 */
}

.ProseMirror table th {
  background-color: #334155; /* slate-700 */
  font-weight: 600;
  color: #f8fafc; /* slate-50 */
}

.ProseMirror table td {
  color: #f1f5f9; /* slate-100 */
}

/* Table cell selection */
.ProseMirror .selectedCell {
  background-color: #1e40af !important; /* blue-800 */
}

/* Table controls */
.ProseMirror .tableWrapper {
  overflow-x: auto;
  margin: 1rem 0;
}

.ProseMirror .resize-cursor {
  cursor: ew-resize;
  cursor: col-resize;
}

/* Ensure the editor takes full height and is scrollable */
.tiptap-editor-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Performance optimizations */
  transform: translateZ(0);
  will-change: scroll-position;
}

.tiptap-editor-container .ProseMirror-focused {
  outline: none;
}

/* Make the editor content scrollable */
.tiptap-editor-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-height: 0; /* This is crucial for flex children to shrink */
  /* Performance optimizations */
  transform: translateZ(0);
  will-change: scroll-position;
  /* Optimize scrolling performance */
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

.tiptap-editor-content .ProseMirror {
  min-height: 100%;
  height: auto;
  padding: 1rem;
  /* Performance optimizations */
  transform: translateZ(0);
  /* Reduce repaints during scrolling */
  contain: layout style paint;
}

/* Slash Command Menu Styles */
.slash-command-menu {
  background: #1e293b; /* slate-800 */
  border: 1px solid #475569; /* slate-600 */
  border-radius: 0.375rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 0.5rem 0;
  max-height: 300px;
  overflow-y: auto;
  width: 280px;
  z-index: 50;
}

.slash-command-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.1s ease;
  text-align: left;
  gap: 0.75rem;
}

.slash-command-item:hover,
.slash-command-item.selected {
  background: #334155; /* slate-700 */
}

.slash-command-icon {
  font-size: 1rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slash-command-content {
  flex: 1;
  min-width: 0;
}

.slash-command-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #f1f5f9; /* slate-100 */
  line-height: 1.25;
}

.slash-command-description {
  font-size: 0.75rem;
  color: #94a3b8; /* slate-400 */
  line-height: 1.25;
}

/* Mobile-specific height constraints */
@media (max-width: 767px) {
  .tiptap-editor-container {
    /* On mobile, account for bottom navigation (48px) and editor status bar (32px) */
    max-height: calc(100vh - 48px - 48px - 32px); /* 100vh - bottom nav - header - status bar */
  }
}

/* Desktop-specific height constraints */
@media (min-width: 768px) {
  .tiptap-editor-container {
    /* On desktop, account for header (48px) and editor status bar (32px) */
    max-height: calc(100vh - 48px - 32px); /* 100vh - header - status bar */
  }
  
  .tiptap-editor-content .ProseMirror {
    max-width: 80ch; /* Optimal reading width - about 65 characters */
    margin: 0 auto; /* Center the content */
  }
}

/* Search highlighting styles */
.search-result-highlight {
  background: rgba(251, 191, 36, 0.4) !important; /* yellow-400 with opacity */
  color: #fbbf24 !important; /* yellow-400 */
  border-radius: 3px;
  padding: 1px 2px;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6);
  animation: highlight-pulse 0.3s ease-out;
}

@keyframes highlight-pulse {
  0% {
    background: rgba(251, 191, 36, 0.8);
    transform: scale(1.02);
  }
  100% {
    background: rgba(251, 191, 36, 0.4);
    transform: scale(1);
  }
}