/* =============================================================================
   utilities.css - Utility & Helper Classes for Story Manager
   Copied from styles.css: utility/helper classes (e.g., .text-center, .d-none, .min-width-220, etc.)
   ============================================================================= */

.text-center, .text-left, .text-right, .text-muted, .d-none, .min-width-220, .min-width-180, .max-h-300, .min-width-320, .min-h-100, .overflow-y-auto-pb20, .enabled-opacity, .enabled-cursor, .disabled-opacity, .disabled-cursor, .mt-0, .mb-0, .mt-1, .mb-1, .p-0, .p-1, .px-2 {
  /* ... (copy all utility/helper class rules here) ... */
}

/* Recent Work Dropdown Font Optimization */
#recentWorkDropdown {
  font-size: 0.875rem !important; /* 14px - smaller base font */
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 180px !important;
}

#recentWorkDropdown span {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 140px !important; /* Leave room for icon */
  display: inline-block !important;
}

#recentWorkList {
  max-width: 280px !important; /* Wider dropdown menu */
  min-width: 200px !important;
}

#recentWorkList .dropdown-item {
  font-size: 0.875rem !important; /* 14px */
  line-height: 1.3 !important;
  padding: 0.5rem 0.75rem !important;
  white-space: normal !important; /* Allow text wrapping in dropdown items */
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

#recentWorkList .dropdown-item i {
  font-size: 0.875rem !important;
  min-width: 16px !important;
  text-align: center !important;
}

#recentWorkList .dropdown-item small {
  font-size: 0.75rem !important; /* 12px */
  line-height: 1.2 !important;
  margin-top: 0.125rem !important;
  display: block !important;
  color: #6c757d !important;
}

#recentWorkList .dropdown-item-text {
  font-size: 0.875rem !important;
  color: #6c757d !important;
  padding: 0.5rem 0.75rem !important;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 575.98px) {
  #recentWorkDropdown {
    font-size: 0.8rem !important; /* 13px */
    max-width: 150px !important;
  }
  
  #recentWorkDropdown span {
    max-width: 110px !important;
  }
  
  #recentWorkList {
    max-width: 240px !important;
    min-width: 180px !important;
  }
  
  #recentWorkList .dropdown-item {
    font-size: 0.8rem !important;
    padding: 0.375rem 0.625rem !important;
  }
  
  #recentWorkList .dropdown-item small {
    font-size: 0.7rem !important; /* 11px */
  }
}

@media (max-width: 480px) {
  #recentWorkDropdown {
    font-size: 0.75rem !important; /* 12px */
    max-width: 130px !important;
  }
  
  #recentWorkDropdown span {
    max-width: 90px !important;
  }
  
  #recentWorkList {
    max-width: 200px !important;
    min-width: 160px !important;
  }
  
  #recentWorkList .dropdown-item {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
  
  #recentWorkList .dropdown-item small {
    font-size: 0.65rem !important; /* 10px */
  }
}

/* Ensure dropdown button text doesn't overflow */
.btn.dropdown-toggle {
  text-overflow: ellipsis !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

/* Dark theme adjustments */
body.theme-dark #recentWorkList .dropdown-item small {
  color: #adb5bd !important;
}

body.theme-dark #recentWorkList .dropdown-item-text {
  color: #adb5bd !important;
}


/* === FLEXIBLE CONTAINER-ADAPTIVE IMAGE SCALING (2024-06-XX) === */
/* Images scale to fit their container's actual dimensions while maintaining aspect ratio */

/* Base flexible wrapper - adapts to parent container's natural size */
.img-fit-wrapper {
  width: 150px !important;
  height: 150px !important;
  background: #f8f9fa !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Container-relative sizing - adapts to parent's dimensions */
.img-fit-wrapper-adapt {
  width: 100%;
  height: 100%;
  min-height: 40px;
  min-width: 40px;
  max-height: 100%;
  max-width: 100%;
}

/* Specific size variations that adapt to container */
.img-fit-wrapper-sm {
  width: 60px;
  height: 60px;
  min-width: 60px;
  min-height: 60px;
  max-width: 60px;
  max-height: 60px;
}

.img-fit-wrapper-md {
  width: 120px;
  height: 120px;
  min-width: 120px;
  min-height: 120px;
  max-width: 120px;
  max-height: 120px;
}

.img-fit-wrapper-lg {
  width: 200px;
  height: 200px;
  min-width: 200px;
  min-height: 200px;
  max-width: 200px;
  max-height: 200px;
}

.img-fit-wrapper-xl {
  width: 300px;
  height: 300px;
  min-width: 300px;
  min-height: 300px;
  max-width: 300px;
  max-height: 300px;
}

/* Responsive breakpoints for fixed-size wrappers */
@media (max-width: 768px) {
  .img-fit-wrapper {
    width: 100px !important;
    height: 100px !important;
  }
  .img-fit-wrapper-sm {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
  }
  .img-fit-wrapper-md {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    max-width: 80px;
    max-height: 80px;
  }
  .img-fit-wrapper-lg {
    width: 140px;
    height: 140px;
    min-width: 140px;
    min-height: 140px;
    max-width: 140px;
    max-height: 140px;
  }
  .img-fit-wrapper-xl {
    width: 200px;
    height: 200px;
    min-width: 200px;
    min-height: 200px;
    max-width: 200px;
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .img-fit-wrapper-sm {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    max-width: 30px;
    max-height: 30px;
  }
  .img-fit-wrapper-md {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    max-width: 60px;
    max-height: 60px;
  }
  .img-fit-wrapper-lg {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    max-width: 100px;
    max-height: 100px;
  }
  .img-fit-wrapper-xl {
    width: 140px;
    height: 140px;
    min-width: 140px;
    min-height: 140px;
    max-width: 140px;
    max-height: 140px;
  }
}

/* Universal image scaling - adapts to container dimensions */
.img-fit {
  width: auto !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
  border-radius: 8px !important;
}

/* Alternative scaling for specific use cases */
.img-fit-cover {
  object-fit: cover !important;
}

.img-fit-fill {
  object-fit: fill !important;
}

/* Hover effects for interactive images */
.img-fit-wrapper:hover .img-fit {
  transform: scale(1.05);
}

/* Focus states for accessibility */
.img-fit-wrapper:focus-within .img-fit {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Loading state */
.img-fit-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
  background-size: 200% 100% !important;
  animation: loading 1.5s infinite !important;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error state */
.img-fit-error {
  background: #f8d7da !important;
  border: 1px solid #f5c6cb !important;
}

.img-fit-error::after {
  content: "Image not available";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #721c24;
  font-size: 0.875rem;
  text-align: center;
}

/* === OVERRIDE ALL BOOTSTRAP IMAGE CLASSES (2024-06-XX) === */
/* Ensure our custom scaling takes precedence over Bootstrap */
.img-fluid,
.img-thumbnail,
.rounded,
.rounded-circle {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0 auto !important;
}

/* === ACCESSIBILITY UTILITIES === */
/* Screen reader only text */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .img-fit-wrapper {
    border: 2px solid #000 !important;
  }
  .img-fit {
    filter: contrast(1.2) !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .img-fit {
    transition: none !important;
  }
  .img-fit-wrapper:hover .img-fit {
    transform: none !important;
  }
}

/* All image scaling for panels and visuals is handled in their respective modular CSS files. No shared image utilities needed at this time. */

/* Universal Dropdown Menu Styling (matches dashboard) */
.dropdown-menu {
    z-index: 9999 !important;
    position: absolute !important;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    background: #fff;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: #222;
    transition: all 0.2s ease;
    background: none;
    border: none;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(0, 95, 204, 0.1);
    color: #005fcc;
    transform: translateX(2px);
    outline: none;
}

.dropdown-item i {
    width: 1rem;
    text-align: center;
}

/* === IMAGE PREVIEW & UPLOAD UTILITIES (migrated 2024-06-XX) === */

.img-fit-filename {
  text-align: center !important;
  font-size: 12px !important;
  color: #666 !important;
  margin-top: 8px !important;
  word-break: break-word !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  display: block !important;
}

/* Responsive breakpoints */
@media (max-width: 575px) {
  .img-fit-wrapper {
    width: 80px !important;
    height: 80px !important;
  }
} 