/* ===== COMMON UTILITIES ===== */

/* Text truncation */
.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Card content protection */
.card-content {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Status indicators */
.text-success {
  color: #10B981;
}

.text-error {
  color: #EF4444;
}

.text-warning {
  color: #F59E0B;
}

.text-teal-600 {
  color: #0D9488;
}

/* Badge container */
.badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

/* Status badge */
.status-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== COMPONENTS ===== */

/* File upload button */
.file-upload-btn {
  background-color: #3B82F6;
  color: white;
  padding: 10px 20px;
  border-radius: 0.375rem;
  cursor: pointer;
  display: inline-block;
  margin-top: 10px;
}

.file-upload-btn:hover {
  background-color: #2563EB;
}

/* Notification variants */
.notification-info {
  background-color: #EFF6FF;
  border-color: #BFDBFE;
  color: #1E40AF;
}

.notification-success {
  background-color: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}

.notification-error {
  background-color: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
}

.notification-warning {
  background-color: #FFFBEB;
  border-color: #FEF3C7;
  color: #92400E;
}

/* ===== CARD STYLES ===== */

/* Base card styles */
.project-card, .manual-card, .page-card, .excel-file-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: all 0.15s ease-in-out;
}

.project-card:hover, .manual-card:hover, .page-card:hover, .excel-file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Selection states */
.project-selected, .manual-selected {
  border-color: #3B82F6 !important;
  box-shadow: 0 0 0 2px rgb(59, 130, 246);
  background-color: #EFF6FF !important;
}

.page-card-selected {
  border: 2px solid #3B82F6 !important;
  box-shadow: 0 0 0 2px rgb(59, 130, 246);
}

/* Page number badge */
.page-number-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  background-color: #F3F4F6;
  color: #4B5563;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

/* Processing status badges */
.status-pending {
  background-color: #FEF3C7;
  color: #92400E;
}

.status-complete {
  background-color: #D1FAE5;
  color: #065F46;
}

.status-error {
  background-color: #FEE2E2;
  color: #B91C1C;
}

/* Page type indicators */
.cad-badge {
  background-color: #dbeafe;
  color: #1e40af;
}

.non-cad-badge {
  background-color: #f3f4f6;
  color: #1f2937;
}

.qc-badge {
  background-color: #fef3c7;
  color: #92400e;
}

/* Badge positions */
.top-right-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.top-left-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
}

/* ===== TAB NAVIGATION ===== */

/* Tab container */
.manual-tabs {
  overflow-x: auto;
  scrollbar-width: thin;
}

.manual-tabs nav {
  display: flex;
  width: max-content;
  min-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -ms-overflow-style: none; /* IE and Edge */
}

.manual-tabs nav::-webkit-scrollbar {
  height: 4px;
}

.manual-tabs nav::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 4px;
}

/* Tab buttons */
.tab-button {
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-button:focus {
  outline: none;
}

.tab-active {
  font-weight: 500;
}

/* ===== EXTRACTED PAGES STYLES ===== */

/* Page numbers display */
#extracted-pages-numbers .flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

#extracted-pages-numbers .flex-wrap span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  text-align: center;
}

/* Page card elements */
.pdf-placeholder {
  transition: all 0.2s ease;
}

.view-pdf-btn, .view-markdown-btn {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s ease;
}

.bg-white.border:hover .view-pdf-btn,
.bg-white.border:hover .view-markdown-btn {
  opacity: 1;
  transform: scale(1);
}

/* Selected pages counter */
#selected-pages-counter {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background-color: #DBEAFE;
  color: #1E40AF;
  border-radius: 0.25rem;
  display: inline-flex;
  align-items: start;
}

/* Table location badge */
.table-location-badge {
  position: absolute;
  top: 2rem;
  left: 0.5rem;
  background-color: #E0E7FF;
  color: #4F46E5;
  font-size: 0.625rem;
  line-height: 1rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

/* ===== EXCEL FILE STYLES ===== */

/* Excel file card */
.excel-file-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.excel-file-icon {
  color: #059669;
  margin-right: 0.25rem;
  flex-shrink: 0;
}

.excel-file-footer {
  margin-top: auto;
  display: flex;
  gap: 0.25rem;
}

.excel-file-button {
  flex: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.excel-view-button {
  background-color: #dbeafe;
  color: #1e40af;
}

.excel-view-button:hover {
  background-color: #bfdbfe;
}

.excel-download-button {
  background-color: #d1fae5;
  color: #065f46;
}

.excel-download-button:hover {
  background-color: #a7f3d0;
}

/* ===== BATCH PROCESSING STYLES ===== */

/* Processing status containers */
#batch-processing-status,
#selected-processing-status {
  transition: all 0.3s ease;
}

#batch-processing-status.bg-blue-100,
#selected-processing-status.bg-blue-100 {
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

#batch-processing-status.bg-green-100,
#selected-processing-status.bg-green-100 {
  border: 1px solid #a7f3d0;
  color: #065f46;
}

#batch-processing-status.bg-red-100,
#selected-processing-status.bg-red-100 {
  border: 1px solid #fecaca;
  color: #b91c1c;
}

#batch-processing-status.bg-yellow-100,
#selected-processing-status.bg-yellow-100 {
  border: 1px solid #fef3c7;
  color: #92400e;
}

/* Processing indicator */
.processing-indicator {
  height: 8px;
  border-radius: 4px;
  background-image: linear-gradient(
    -45deg,
    rgba(59, 130, 246, 0.5) 25%,
    rgba(59, 130, 246, 0.7) 25%,
    rgba(59, 130, 246, 0.7) 50%,
    rgba(59, 130, 246, 0.5) 50%,
    rgba(59, 130, 246, 0.5) 75%,
    rgba(59, 130, 246, 0.7) 75%,
    rgba(59, 130, 246, 0.7) 100%
  );
  background-size: 16px 16px;
  animation: move 1s linear infinite;
}

/* ===== MARKDOWN PREVIEW STYLES ===== */

/* Prose styles for markdown */
.prose {
  color: #374151;
  max-width: 65ch;
  line-height: 1.6;
}

.prose p {
  margin-top: 1.25em;
  margin-bottom: 1.25em;
}

.prose h1 {
  color: #111827;
  font-weight: 800;
  font-size: 2em;
  margin-top: 0;
  margin-bottom: 0.8em;
  line-height: 1.1;
}

.prose h2 {
  color: #111827;
  font-weight: 700;
  font-size: 1.5em;
  margin-top: 2em;
  margin-bottom: 1em;
  line-height: 1.3;
}

.prose h3 {
  color: #111827;
  font-weight: 600;
  font-size: 1.25em;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  line-height: 1.6;
}

.prose strong {
  color: #111827;
  font-weight: 600;
}

.prose em {
  font-style: italic;
}

.prose a {
  color: #2563EB;
  text-decoration: underline;
  font-weight: 500;
}

.max-w-none {
  max-width: none;
}

/* ===== ANIMATIONS ===== */

/* Spinner animation */
@keyframes spinner {
  to {transform: rotate(360deg);}
}

.spinner {
  animation: spinner 1s linear infinite;
}

/* Shimmer animation */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.project-loading-placeholder {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(to right, #f6f7f8 8%, #edeef1 18%, #f6f7f8 33%);
  background-size: 1000px 100%;
}

/* Pulse animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.animate-pulse, .upload-pulse, .processing-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Processing animation */
@keyframes move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 16px 0;
  }
}

/* ===== RESPONSIVE STYLES ===== */

/* Mobile adjustments */
@media (max-width: 640px) {
  #extracted-pages-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  #excel-files-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium screens */
@media (min-width: 641px) and (max-width: 768px) {
  #extracted-pages-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  #excel-files-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Larger screens */
@media (min-width: 769px) and (max-width: 1024px) {
  #excel-files-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1025px) {
  #extracted-pages-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  
  #excel-files-list {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Hide text on very small screens */
@media (max-width: 374px) {
  .excel-button-text {
    display: none;
  }
  
  .excel-button-icon {
    margin-right: 0;
  }
}

/* In components.css - Add the following rules */
.manual-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: all 0.15s ease-in-out;
  word-break: break-word;
}

.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;  
  overflow: hidden;
  word-break: break-word;
}

/* Page card improvements */
.page-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: all 0.2s ease-in-out;
  word-break: break-word;
}

/* Text truncation for IDs */
.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

/* Selected page card styling */
.page-card-selected {
  border: 2px solid #3B82F6 !important;
  box-shadow: 0 0 0 2px rgb(59, 130, 246);
}

/* Button visibility improvements */
.view-pdf-btn, .view-markdown-btn {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.2s ease;
}

.page-card:hover .view-pdf-btn,
.page-card:hover .view-markdown-btn {
  opacity: 1;
  transform: scale(1);
}

/* 
 * Extracted Pages UI Improvements
 * This CSS addresses the layout issues with the Extracted Pages section
 */

/* 1. Remove container and grey background from Pages section */
#extracted-pages-numbers {
  background-color: transparent !important;
  border: none !important;
  padding: 0.75rem 0 !important;
  margin: 0 !important;
}

/* 2. Add proper gap between Pages section and selected counter */
#selected-pages-counter {
  margin-top: 0.5rem !important;
  margin-bottom: 1rem !important;
  display: inline-block !important;
  padding: 0.375rem 0.75rem !important;
}

/* 3. Fix page card tile indentation to match manual cards */
#extracted-pages-grid {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Fix overall container padding */
.bg-white.shadow.overflow-hidden.sm\:rounded-lg.mb-6 .border-t.border-gray-200 {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Keep section headers properly padded */
.bg-white.shadow.overflow-hidden.sm\:rounded-lg.mb-6 .px-4.py-5.sm\:px-6 {
  /* padding-left: 1.5rem !important; */
  padding-right: 1.5rem !important;
}

/* Update the page grid layout for consistent spacing */
#extracted-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
}

/* Add proper space between selected counter and grid */
#selected-pages-counter {
  margin-left: 1.5rem !important;
}

/* Add these styles to components.css */

/* Logo styling */
#app-logo, #login-logo {
  max-height: 50px;
  width: auto;
  transition: all 0.3s ease;
}

#login-logo {
  max-height: 64px;
}

/* Loading state */
.logo-loading {
  opacity: 0.6;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  #app-logo {
    max-height: 40px;
  }
  
  #login-logo {
    max-height: 50px;
  }
}

/* Dark mode handling for logo - add to dark-mode.css */
body.dark-mode #app-logo,
body.dark-mode #login-logo {
  filter: brightness(0) invert(1);
}