/* FYS Live Search Modal - Modern WooCommerce Search */

:root {
  --fys-primary: #0076df;
  --fys-primary-hover: #005bb5;
  --fys-bg-overlay: rgba(15, 23, 42, 0.65);
  --fys-backdrop-blur: 5px;
  --fys-modal-bg: #ffffff;
  --fys-text-main: #1e293b;
  --fys-text-muted: #64748b;
  --fys-input-bg: #f1f5f9;
  --fys-input-focus: #ffffff;
  --fys-border-color: #e2e8f0;
  --fys-card-hover: #f8fafc;
  --fys-sale-badge: #ef4444;
  --fys-stock-green: #10b981;
  --fys-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --fys-radius: 12px;
}

/* Modal Wrapper & Backdrop */
.fys-modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.fys-modal-wrapper.fys-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.fys-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--fys-bg-overlay, rgba(15, 23, 42, 0.65));
  backdrop-filter: blur(var(--fys-backdrop-blur, 5px));
  -webkit-backdrop-filter: blur(var(--fys-backdrop-blur, 5px));
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

/* Modal Panel (Top Dropdown / Expanding) */
.fys-modal-panel {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: var(--fys-modal-bg);
  box-shadow: var(--fys-shadow-lg);
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--fys-border-color);
  min-height: 40vh;
  max-height: 85vh;
  transform: translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), min-height 0.3s ease, max-height 0.3s ease;
  z-index: 2;
  overflow: hidden;
}

.fys-modal-wrapper.fys-active .fys-modal-panel {
  transform: translateY(0);
}

/* Modal Header Search Bar */
.fys-modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #edf2f7;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.fys-search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 750px;
  background: var(--fys-input-bg);
  border-radius: 9999px;
  padding: 2px 8px 2px 14px;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.fys-search-input-box:focus-within {
  background: var(--fys-input-focus);
  border-color: var(--fys-primary);
  box-shadow: 0 0 0 4px rgba(0, 118, 223, 0.15);
}

.fys-input-icon-left {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fys-primary);
  margin-right: 8px;
  flex-shrink: 0;
}

.fys-search-glyph {
  stroke: var(--fys-primary);
}

.fys-search-field {
  width: 100%;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  color: var(--fys-text-main) !important;
  padding: 10px 4px !important;
  margin: 0 !important;
  font-family: inherit;
}

.fys-search-field::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Clear button & spinner */
.fys-clear-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

.fys-clear-btn:hover {
  color: #334155;
  background: #e2e8f0;
}

.fys-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #e2e8f0;
  border-top-color: var(--fys-primary);
  border-radius: 50%;
  animation: fys-spin 0.6s linear infinite;
  margin-left: 6px;
  flex-shrink: 0;
}

@keyframes fys-spin {
  to { transform: rotate(360deg); }
}

/* Cancel Button */
.fys-cancel-btn {
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.fys-cancel-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

/* Modal Body */
.fys-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.fys-modal-body::-webkit-scrollbar {
  width: 6px;
}
.fys-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.fys-modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.fys-modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Section Titles */
.fys-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.fys-title-text {
  font-size: 15px;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fys-subtitle-text {
  font-size: 13px;
  color: #94a3b8;
}

.fys-results-header {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fys-count-badge {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 999px;
}

/* Products Grid */
.fys-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* Product Card */
.fys-product-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--fys-border-color);
  border-radius: var(--fys-radius);
  text-decoration: none !important;
  color: inherit !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  overflow: hidden;
}

.fys-product-card:hover,
.fys-product-card.fys-selected {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  background: var(--fys-card-hover);
}

.fys-product-thumb-wrap {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
}

.fys-product-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.fys-product-card:hover .fys-product-thumb {
  transform: scale(1.05);
}

.fys-product-info {
  flex: 1;
  min-width: 0;
}

.fys-product-category {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fys-product-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fys-text-main);
  line-height: 1.35;
  margin: 0 0 6px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fys-highlight {
  background-color: rgba(0, 118, 223, 0.12);
  color: var(--fys-primary);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 2px;
}

.fys-product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fys-product-price {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.fys-product-price del {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
  margin-right: 4px;
}

.fys-product-price ins {
  text-decoration: none;
  color: #dc2626;
}

.fys-popular-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: #fef3c7;
  color: #b45309;
  border-radius: 4px;
  white-space: nowrap;
}

/* Empty State */
.fys-empty-state {
  text-align: center;
  padding: 48px 16px;
}

.fys-empty-icon {
  color: #94a3b8;
  margin-bottom: 12px;
}

.fys-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 8px 0;
}

.fys-empty-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

/* Footer & Hints */
.fys-modal-footer {
  padding: 10px 24px;
  background: #f8fafc;
  border-top: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.fys-shortcut-hints {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #94a3b8;
}

.fys-hint-item kbd {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  color: #475569;
}

/* Shortcode Trigger Button */
.fys-search-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fys-search-trigger-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Search Bar Widget Shortcode */
.fys-search-bar-widget {
  width: 100%;
  cursor: pointer;
  box-sizing: border-box;
}

.fys-search-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.fys-search-bar-widget:hover .fys-search-bar-inner {
  background: #ffffff;
  border-color: var(--fys-primary);
  box-shadow: 0 4px 14px rgba(0, 118, 223, 0.12);
}

.fys-bar-icon {
  color: var(--fys-primary);
  flex-shrink: 0;
}

.fys-bar-placeholder {
  color: #94a3b8;
  font-size: 15px;
  font-weight: 400;
  user-select: none;
}

/* Skeleton Loading Shimmer */
.fys-skeleton-card {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: var(--fys-radius);
}

.fys-skeleton-thumb {
  width: 68px;
  height: 68px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: fys-shimmer 1.5s infinite;
  margin-right: 14px;
}

.fys-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fys-skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: fys-shimmer 1.5s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .fys-modal-panel {
    min-height: 50vh;
    max-height: 92vh;
  }

  .fys-modal-header {
    padding: 12px 16px;
    gap: 8px;
  }

  .fys-products-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .fys-product-thumb-wrap {
    width: 58px;
    height: 58px;
  }

  .fys-shortcut-hints {
    display: none;
  }
}
