/* =============================================
   search.css — Search Modal Styles
   ============================================= */

/* =====================
   SEARCH MODAL OVERLAY
   ===================== */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.3);
}

.search-modal.active {
  display: flex;
}

/* =====================
   SEARCH MODAL CONTENT
   ===================== */
.search-modal__content {
  position: relative;
  width: calc(100vw - 80px);
  height: calc(100vh - 80px);
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =====================
   MODAL HEADER
   ===================== */
.search-modal__header {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 32px;
  gap: 16px;
  width: 100%;
  height: 104px;
  border-bottom: 1px solid #E8E8ED;
}

/* Search container with icon and input */
.search-modal__search {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  position: relative;
}

.search-modal__search svg {
  width: 24px;
  height: 24px;
  color: #000000;
  position: absolute;
  left: 16px;
  pointer-events: none;
}

.search-modal__input {
  height: 48px;
  padding: 0 16px 0 56px;
  border: 1.5px solid #C3C7C9;
  border-radius: 12px;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  color: #000000;
  background: #FFFFFF;
  transition: border-color 0.2s;
  width: 100%;
  outline: none;
}

.search-modal__input:focus {
  border-color: #000000;
}

.search-modal__input::placeholder {
  color: #545455;
}

/* Close button */
.search-modal__close {
  width: 40px;
  height: 40px;
  background: #F2F2F2;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.search-modal__close:hover {
  background: #e0e0e0;
}

.search-modal__close svg {
  width: 20px;
  height: 20px;
  color: #000000;
}

/* =====================
   MODAL BODY
   ===================== */
.search-modal__body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  padding: 0px;
  width: 100%;
  flex: 1;
  overflow: hidden;
}

/* =====================
   FILTERS COLUMN
   ===================== */
.search-modal__filters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 32px;
  gap: 16px;
  width: 320px;
  border-right: 1px solid #E8E8ED;
  overflow-y: auto;
  height: 100%;
}

.filter-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  color: #545455;
  line-height: 1.2;
  margin-bottom: 4px;
}

.search-modal__filter-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0px;
  gap: 4px;
  width: 256px;
  height: 64px;
  flex-shrink: 0;
}

.search-modal__filter-group svg {
  width: 16px;
  height: 16px;
  color: #545455;
  margin-bottom: 4px;
}

.search-modal__select {
  height: 48px;
  padding: 0 36px 0 20px;
  border: 1px solid #C3C7C9;
  border-radius: 12px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  color: #000000;
  background: #FFFFFF;
  cursor: pointer;
  outline: none;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%23545455' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}

.search-modal__select:focus {
  border-color: #000000;
}

.search-modal__select:hover {
  border-color: #000000;
}

/* =====================
   PRODUCTS COLUMN
   ===================== */
.search-modal__products {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: #FFFFFF;
  height:100%;
}

.search-modal__products-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow:1;
}

/* Loading state */
.search-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #545455;
}

.search-modal__spinner {
  width: 40px;
  height: 40px;
  color: #000000;
  animation: rotate 1s linear infinite;
  margin-bottom: 16px;
}

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

/* Empty state */
.search-modal__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #545455;
  text-align: center;
}

.search-modal__empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Error state */
.search-modal__error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #dc3545;
  text-align: center;
}

.search-modal__error svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

/* =====================
   PRODUCT CARDS
   ===================== */
.search-modal__product-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0px;
  padding-right: 20px;
  gap: 16px;
  width: 100%;
  height: 120px;
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.search-modal__product-card:hover {
  border-color: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Product image */
.search-modal__product-image {
  flex: none;
  width: 120px;
  height: 120px;
  border: 1px solid #E8E8ED;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
}

.search-modal__product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Product info */
.search-modal__product-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0px;
  gap: 12px;
  opacity: 0.7;
}

.search-modal__product-name {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: #000000;
  margin: 0;
  width: 100%;
}

.search-modal__product-details {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #000000;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* =====================
   PRODUCT ACTIONS
   ===================== */
.search-modal__product-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0px;
  gap: 8px;
}

.search-modal__action-btn {
  width: 40px;
  height: 40px;
  background: #F2F2F2;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}

.search-modal__action-btn:hover {
  background: #e0e0e0;
}

.search-modal__action-btn svg {
  width: 20px;
  height: 20px;
  color: #000000;
}

.search-modal__action-btn--link {
  background: #F2F2F2;
}

.search-modal__action-btn--save {
  background: #F2F2F2;
  width: auto;
  padding-left: 16px;
  padding-right: 16px;
}

.search-modal__action-btn--config {
  background: #000000;
  color: #FFFFFF;
  width: 89px;
}

.search-modal__action-btn--config:hover {
  background: #1a1a1a;
}

.search-modal__action-btn--config svg {
  display: none;
}

/* =====================
   PAGINATION
   ===================== */
.search-modal__pagination {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 32px;
  width: 100%;
  border-top: 1px solid #E8E8ED;
}

.search-modal__pagination-btn {
  height: 40px;
  padding: 0 24px;
  border: 1.5px solid #C3C7C9;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: #000000;
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-modal__pagination-btn:hover:not(:disabled) {
  border-color: #000000;
  background: #f5f5f5;
}

.search-modal__pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.search-modal__pagination-info {
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  color: #545455;
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 768px) {
  .search-modal {
    padding: 0;
  }
  
  .search-modal__content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  
  .search-modal__body {
    flex-direction: column;
  }
  
  .search-modal__filters {
    width: 100%;
    height: auto;
    max-height: 120px;
    border-right: none;
    border-bottom: 1px solid #E8E8ED;
  }
  
  .search-modal__products {
    height: calc(100% - 120px - 104px);
  }
  
  .search-modal__product-card {
    flex-direction: column;
    height: auto;
    padding: 16px;
  }
  
  .search-modal__product-image {
    width: 100%;
    height: 150px;
  }
  
  .search-modal__product-info {
    width: 100%;
  }
  
  .search-modal__product-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 16px;
  }
}
