/**
 * Custom Styles for One-Pager Assistant
 * Tailwind CSS is loaded via CDN - this file contains custom overrides
 */

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    color-scheme: dark;
  }
}

/* Line clamp 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;
}

/* Smooth transitions */
* {
  transition-property: background-color, border-color, color;
  transition-duration: 200ms;
  transition-timing-function: ease-in-out;
}

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

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

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

.dark ::-webkit-scrollbar-thumb {
  background: #4a5568;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #718096;
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.notification {
  animation: slideIn 0.3s ease-out;
}

.notification.removing {
  animation: slideOut 0.3s ease-in;
}

/* Phase indicator */
.phase-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.phase-indicator.active {
  font-weight: 600;
}

.phase-indicator.completed::before {
  content: '✓';
  color: #10b981;
}

.phase-indicator.active::before {
  content: '→';
  color: #3b82f6;
}

/* Textarea auto-resize */
textarea {
  resize: vertical;
  min-height: 100px;
}

/* Loading spinner */
.spinner {
  border: 2px solid #f3f4f6;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Focus styles for accessibility */
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  header,
  #aiMockToggle,
  #notifications,
  button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* ========================================
   ACTION MENU (Overflow Menu) STYLES
   WCAG 2.1 AA Compliant
   ======================================== */

.action-menu {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  max-width: 280px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
  transition:
    opacity 150ms ease-out,
    transform 150ms ease-out;
}

.dark .action-menu {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.action-menu-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.action-menu-closing {
  opacity: 0;
  transform: translateY(-8px) scale(0.95);
}

.action-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #374151;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color 100ms ease;
  /* Touch-friendly: minimum 44px height */
  min-height: 44px;
}

.dark .action-menu-item {
  color: #e5e7eb;
}

.action-menu-item:hover,
.action-menu-item:focus {
  background: #f3f4f6;
  outline: none;
}

.dark .action-menu-item:hover,
.dark .action-menu-item:focus {
  background: #374151;
}

.action-menu-item:focus {
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.action-menu-item-disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.dark .action-menu-item-disabled {
  color: #6b7280;
}

.action-menu-item-disabled:hover,
.action-menu-item-disabled:focus {
  background: transparent;
}

.action-menu-item-destructive {
  color: #dc2626;
}

.dark .action-menu-item-destructive {
  color: #f87171;
}

.action-menu-item-destructive:hover,
.action-menu-item-destructive:focus {
  background: #fef2f2;
}

.dark .action-menu-item-destructive:hover,
.dark .action-menu-item-destructive:focus {
  background: rgba(239, 68, 68, 0.15);
}

.action-menu-icon {
  margin-right: 10px;
  font-size: 16px;
  flex-shrink: 0;
}

.action-menu-label {
  flex: 1;
}

.action-menu-separator {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 0;
}

.dark .action-menu-separator {
  background: #374151;
}

/* Trigger button styling */
.action-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
  /* Touch-friendly: minimum 44px */
  min-height: 44px;
  min-width: 44px;
}

.dark .action-menu-trigger {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.action-menu-trigger:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.dark .action-menu-trigger:hover {
  background: #4b5563;
  border-color: #6b7280;
}

.action-menu-trigger[aria-expanded='true'] {
  background: #e5e7eb;
  border-color: #3b82f6;
}

.dark .action-menu-trigger[aria-expanded='true'] {
  background: #4b5563;
  border-color: #3b82f6;
}
