@import './themes.css';
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  * {
    border-color: hsl(var(--border));
  }

  html {
    height: 100%;
    /* Smooth transition for theme changes */
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  body {
    height: 100%;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-feature-settings: "rlig" 1, "calt" 1;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  #app {
    height: 100%;
  }
}

/* Custom scrollbar */
.scrollbar-thin {
  scrollbar-width: thin;
}

.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.2);
  border-radius: 9999px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.4);
}

/* Disable text selection on UI elements */
.no-select {
  -webkit-user-select: none;
  user-select: none;
}

/* Wails window drag */
.wails-drag {
  --wails-draggable: drag;
}

/* Search highlight styling */
mark {
  background-color: hsl(var(--primary) / 0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

/* Pane focus flash animation for keyboard navigation */
@keyframes pane-focus-flash {
  0% {
    box-shadow: inset 0 0 0 2px hsl(var(--primary));
  }
  100% {
    box-shadow: inset 0 0 0 0 transparent;
  }
}

.pane-focus-flash {
  animation: pane-focus-flash 0.3s ease-out;
}

/* Smooth slide-down for conversation viewer content */
@keyframes conversation-slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.conversation-viewer-content {
  animation: conversation-slide-down 0.2s ease-out;
}

/* Composer editor styles - optimized for email composition */
/* Replaces prose/prose-sm for better performance and cursor behavior */
.composer-editor {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem; /* 14px */
  line-height: 1.5;
  color: hsl(var(--foreground));
}

.composer-editor p {
  margin: 0;
}

.composer-editor a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.composer-editor blockquote {
  border-left: 3px solid hsl(var(--border));
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: hsl(var(--muted-foreground));
}

.composer-editor ul,
.composer-editor ol {
  list-style: none;
  padding-left: 2.5rem;
  margin: 0.25rem 0;
}

.composer-editor li {
  margin: 0.125rem 0;
  position: relative;
}

.composer-editor ul > li::before {
  content: '\2022';
  position: absolute;
  left: -1rem;
  color: hsl(var(--foreground));
}

.composer-editor ol {
  counter-reset: composer-list;
}

.composer-editor ol > li {
  counter-increment: composer-list;
}

.composer-editor ol > li::before {
  content: counter(composer-list) '.';
  position: absolute;
  left: -1.25rem;
  color: hsl(var(--foreground));
}

.composer-editor strong {
  font-weight: 600;
}

.composer-editor em {
  font-style: italic;
}

.composer-editor u {
  text-decoration: underline;
}

.composer-editor s {
  text-decoration: line-through;
}

.composer-editor code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background-color: hsl(var(--muted));
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

.composer-editor pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background-color: hsl(var(--muted));
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.composer-editor img {
  max-width: 100%;
  height: auto;
}

/* Signature editor uses same base styles */
.signature-editor {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
}

.signature-editor p {
  margin: 0;
}

.signature-editor a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.signature-editor img {
  max-width: 100%;
  height: auto;
}

/* Responsive layout overlays */
.responsive-sidebar-overlay {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 30;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
}

.responsive-sidebar-visible {
  transform: translateX(0);
}

.responsive-viewer-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
}

.responsive-viewer-visible {
  transform: translateX(0);
}

.responsive-scrim {
  position: absolute;
  inset: 0;
  z-index: 29;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.25s ease-out;
}

.responsive-scrim-visible {
  background: rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}
