/**
 * PIM-Specific Style Overrides
 * Custom styles for PIM functionality that should persist across theme updates
 */

/* Make graph gradients end at white instead of lighter color */
[id^="SvgjsLinearGradient"] stop[offset="1"] {
  stop-color: #ffffff !important;
  stop-opacity: 0 !important;
}

/* Also target any empty stop colors */
[id^="SvgjsLinearGradient"] stop[stop-color=""] {
  stop-color: #ffffff !important;
  stop-opacity: 0 !important;
}

/* PIM Custom Search Functionality Styles */

/* Hide utility class */
.pim-hidden {
  display: none !important;
}

/* PIM Search Trigger */
.pim-nav-search-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.pim-search-trigger {
  display: flex !important;
  align-items: center;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: inherit;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.pim-search-trigger:hover {
  background-color: rgba(0, 0, 0, 0.05);
  color: inherit;
  text-decoration: none;
}

.pim-search-icon {
  margin-right: 0.5rem;
  font-size: 1.25rem;
}

.pim-search-text {
  font-size: 0.875rem;
  color: #6c757d;
}

@media (max-width: 767.98px) {
  .pim-search-text {
    display: none;
  }
}

/* PIM In-place Search Wrapper */
.pim-search-wrapper {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

.pim-search-input-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: inherit;
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  height: 100%;
}

.pim-search-input-wrapper.pim-hidden {
  display: none !important;
}

.pim-typeahead-wrapper {
  position: relative;
  display: inline-block;
  flex-grow: 1;
  width: 100%;
}

.pim-search-input {
  width: 100%;
  background: var(--bs-body-bg) !important;
  border: 1px solid var(--bs-border-color) !important;
  border-radius: var(--bs-border-radius) !important;
  color: var(--bs-body-color) !important;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  outline: none !important;
  box-shadow: var(--bs-box-shadow-sm) !important;
}

.pim-search-input::placeholder {
  color: var(--bs-secondary-color) !important;
}

.pim-search-input:focus {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25) !important;
  outline: none !important;
}

/* Theme-specific styling */
[data-bs-theme="dark"] .pim-search-input {
  background: var(--bs-dark) !important;
  border-color: var(--bs-border-color) !important;
  color: var(--bs-light) !important;
}

.pim-search-close {
  margin-left: 0.75rem;
  color: var(--bs-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0.25rem;
  border-radius: 50%;
}

.pim-search-close:hover {
  background-color: var(--bs-secondary-bg);
  color: var(--bs-primary);
  transform: scale(1.1);
}

/* PIM Search Suggestions */
.pim-search-suggestions {
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  margin-top: 0.5rem;
  width: 100% !important;
  min-width: 300px;
}

.pim-search-suggestions.pim-hidden {
  display: none !important;
}

.pim-suggestion {
  display: flex !important;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  width: 100%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.pim-suggestion:hover,
.pim-suggestion.pim-active {
  background-color: rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
}

.pim-suggestion:last-child {
  border-bottom: none;
}

.suggestions-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

.suggestion:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* MPN display in search results */
.search-mpn {
  font-size: 0.75rem;
  color: #6c757d;
  font-style: italic;
}

/* PIM Form Styles */
.pim-form-section {
  margin-bottom: 2rem;
}

.pim-form-section .form-label {
  font-weight: 600;
  color: #5a5a5a;
}

/* Product management specific styles */
.product-image-preview {
  max-width: 200px;
  max-height: 200px;
  border: 2px dashed #dee2e6;
  padding: 1rem;
  text-align: center;
}

/* Category management styles */
.category-tree {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  padding: 1rem;
}

/* Brand management styles */
.brand-logo-container {
  max-width: 150px;
  max-height: 150px;
}

/* Data tables customization for PIM */
.pim-datatable .table th {
  background-color: #f8f9fa;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
}

.pim-datatable .table td {
  vertical-align: middle;
}

/* Status badges for PIM */
.pim-status-active {
  background-color: #28a745 !important;
}

.pim-status-inactive {
  background-color: #dc3545 !important;
}

.pim-status-pending {
  background-color: #ffc107 !important;
  color: #212529 !important;
}

/* Import/Export functionality */
.pim-import-progress {
  margin-top: 1rem;
}

.pim-export-options {
  padding: 1rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  background-color: #f8f9fa;
}

/* Custom alerts for PIM */
.pim-alert-info {
  border-left: 4px solid #0dcaf0;
  background-color: rgba(13, 202, 240, 0.1);
}

.pim-alert-warning {
  border-left: 4px solid #ffc107;
  background-color: rgba(255, 193, 7, 0.1);
}

.pim-alert-success {
  border-left: 4px solid #198754;
  background-color: rgba(25, 135, 84, 0.1);
}

/* Responsive adjustments for PIM */
@media (max-width: 768px) {
  .pim-form-section {
    margin-bottom: 1.5rem;
  }

  .product-image-preview {
    max-width: 150px;
    max-height: 150px;
  }
}

/* Dark mode adjustments for PIM elements */
[data-bs-theme="dark"] .suggestions-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .suggestion:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .pim-form-section .form-label {
  color: #adb5bd;
}

[data-bs-theme="dark"] .pim-export-options {
  background-color: #343a40;
  border-color: #495057;
}
/* Direct Search Bar Styles - No Overlay */
.navbar-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 300px;
    background-color: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
    height: 42px;
    padding: 0;
}

.navbar-search-wrapper .search-input {
    padding: 0.375rem 0.75rem 0.375rem 2.5rem !important;
    min-width: 200px;
    border: none !important;
}

.navbar-search-wrapper .ti-search {
    position: absolute;
    left: 0.75rem;
    color: #8c8fa6;
    z-index: 1;
}

/* Completely hide any overlay wrapper */
.search-input-wrapper {
    display: none !important;
}

.navbar-search-wrapper .twitter-typeahead {
    width: 100% !important;
    display: block !important;
}

.search-input {
    font-size: 15px;
    background-color: transparent !important;
    box-shadow: none !important;
}

.search-input:focus {
    outline: none;
    box-shadow: none !important;
    border-color: transparent !important;
}

/* Content Backdrop - Only blur content below navbar */
.content-backdrop {
    position: fixed;
    top: 70px; /* Adjust this to match your navbar height */
    left: 0;
    z-index: 999;
    width: 100vw;
    height: calc(100vh - 70px);
    background-color: rgba(67, 89, 113, 0.3);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease-in-out;
}

.content-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* Typeahead Dropdown */
.navbar-search-suggestion {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1001;
    max-height: 350px;
    overflow-y: auto;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: var(--bs-border-radius, 0.375rem);
    box-shadow: 0 0.25rem 1rem rgba(161, 172, 184, 0.45);
}

.navbar-search-suggestion .suggestion:hover {
    background-color: var(--bs-gray-50, #f8f9fa);
}

.navbar-search-suggestion .suggestion.active {
    background-color: var(--bs-primary, #696cff);
    color: white;
}

.navbar-search-suggestion .suggestions-header {
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.navbar-search-suggestion .not-found {
    color: var(--bs-text-muted, #a8aaae);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .navbar-search-wrapper.search-input-wrapper {
    background-color: var(--bs-dark, #233446);
    border-bottom-color: var(--bs-border-color-translucent, rgba(255, 255, 255, 0.15));
}

[data-bs-theme="dark"] .navbar-search-suggestion {
    background: var(--bs-dark, #233446);
    border-color: var(--bs-border-color-translucent, rgba(255, 255, 255, 0.15));
}

[data-bs-theme="dark"] .navbar-search-suggestion .suggestion:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments */
@media (max-width: 1199.98px) {
    .navbar-search-wrapper.search-input-wrapper {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1030;
        height: auto;
        padding: 1rem;
    }
}

/* DASHBOARD CHART FIXES - Bootstrap 5 Compatibility */

/* Fix for General Information Chart (Warehouse Product Counts) */
#general-information-container {
    /* Ensure proper flex behavior */
    display: flex !important;
    flex-direction: column !important;
    min-height: 410px !important;
}

#general-information-container .card {
    /* Card should expand to fill container */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 410px !important;
}

#general-information-container .card-body {
    /* Card body should expand */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    min-height: 300px !important;
}

/* Chart container specific fixes */
#generalInformationChart {
    /* Force dimensions for ApexCharts */
    min-height: 300px !important;
    height: 300px !important;
    width: 100% !important;
    position: relative !important;

    /* Ensure proper box sizing */
    box-sizing: border-box !important;

    /* Force layout calculation */
    contain: layout !important;
}

/* Bootstrap 5 Layout Fix - Force recalculation */
#general-information-container .row.g-3 {
    min-height: 300px !important;
}

#general-information-container .col-12 {
    display: flex !important;
    flex-direction: column !important;
    min-height: 300px !important;
}

/* Dark mode support */
[data-bs-theme="dark"] #generalInformationChart:empty {
    background: linear-gradient(90deg, #3a3a3a 25%, transparent 25%, transparent 50%, #3a3a3a 50%, #3a3a3a 75%, transparent 75%, transparent);
    background-size: 20px 20px;
}

.text-muted {
    --bs-text-opacity: 1;
    color: #a5a3ae !important;
}

.note-custom {
    float:right !important;
}

/* Fix tab spacing issue - hide inactive tabs completely */
.tab-pane:not(.show) {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
}

/* Fix switch slider positioning - override core CSS */
.switch-toggle-slider .switch-on,
.switch-toggle-slider .switch-off {
    display: flex;
    align-items: center;      /* Vertical centering */
    justify-content: center;  /* Horizontal centering */
    position: absolute;
    top: 0;
}

/* Fix for Summernote modal z-index issue */
.note-modal {
    z-index: 10000 !important;
}

.note-modal.moved-to-body {
    z-index: 10000 !important;
}

.note-modal .modal-backdrop {
    z-index: 9999 !important;
}

/* Fix btn-outline-primary in dark mode */
[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: #fff !important;
  --bs-btn-border-color: #fff !important;
  --bs-btn-hover-color: #fff !important;
  --bs-btn-active-color: #fff !important;
}

/* Fix side bar icon expand/collapse */
[data-bs-theme="light"] .menu-link {
  color: rgb(109, 107, 119)
}

[data-bs-theme="dark"] .menu-link {
  color: rgb(172, 171, 193);
}

.layout-menu-collapsed .layout-menu-toggle .menu-toggle-icon {
      opacity: 0;
}

.layout-menu-toggle .menu-toggle-icon {
 background-color: currentColor;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.layout-menu-collapsed.layout-menu-hover .layout-menu-toggle .menu-toggle-icon {
    display: block;
    opacity: 1;
}

/* Fix chart text visibility */
[data-bs-theme="light"] .apexcharts-text,
[data-bs-theme="light"] .apexcharts-xaxis-label,
[data-bs-theme="light"] .apexcharts-yaxis-label,
[data-bs-theme="light"] .apexcharts-xaxis-title-text,
[data-bs-theme="light"] .apexcharts-yaxis-title-text {
  fill: #a5a3ae !important;
}

[data-bs-theme="dark"] .apexcharts-text,
[data-bs-theme="dark"] .apexcharts-xaxis-label,
[data-bs-theme="dark"] .apexcharts-yaxis-label,
[data-bs-theme="dark"] .apexcharts-xaxis-title-text,
[data-bs-theme="dark"] .apexcharts-yaxis-title-text {
  fill: #ffffff !important;
}

[data-bs-theme="dark"] .apexcharts-gridline {
  stroke: #444 !important;
}

.switch .switch-toggle-slider {
    inline-size: 3rem;
}

.switch .switch-label{
  margin-left: 0.5rem;
}

[data-bs-theme="dark"]  .select2-container--default .select2-results__option[aria-selected=true] {
    color: var(--bs-select-color) !important;
}