/**
 * MotoPoint Importer - Front-end Styles
 * Vehicle Selector Styling
 * @author    arpyke
 * @copyright 2026 arpyke
 * @license   Commercial
 * @version   1.1.5
 */

/* ============================================
   HEADER SELECTOR - FULL WIDTH BELOW MENU
   ============================================ */

.motopoint-selector-header {
    background: #c0392b;
    padding: 15px 0;
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.motopoint-selector-header.motopoint-sticky {
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

/* Sticky fallback for themes that break position:sticky (overflow/transform on parents) */
.motopoint-selector-header.motopoint-sticky.motopoint-sticky-fixed {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    z-index: 998;
}

.motopoint-sticky-placeholder {
    display: none;
    width: 100%;
}


.motopoint-selector-header .motopoint-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Main selector row - INLINE HORIZONTAL */
.motopoint-selector-header .motopoint-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
}

/* Individual field */
.motopoint-selector-header .motopoint-field {
    flex: 1;
    min-width: 0;
}

.motopoint-selector-header .motopoint-field-wide {
    flex: 1.5;
}

.motopoint-selector-header .motopoint-field-btn {
    flex: 0 0 auto;
}

/* Select styling - WHITE BACKGROUND */
.motopoint-selector-header .motopoint-select {
    width: 100%;
    height: 42px;
    padding: 8px 32px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #ffffff;
    color: #2c3e50;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c3e50' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.motopoint-selector-header .motopoint-select:hover:not(:disabled) {
    border-color: #2c3e50;
}

.motopoint-selector-header .motopoint-select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.2);
}

.motopoint-selector-header .motopoint-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.motopoint-selector-header .motopoint-select option {
    background-color: #fff;
    color: #2c3e50;
}

/* Search/Apply button */
.motopoint-selector-header .motopoint-btn-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 25px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#motopoint-selector .motopoint-btn-search:hover:not(:disabled),
.motopoint-selector-header .motopoint-btn-search:hover:not(:disabled) {
    background: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#motopoint-selector .motopoint-btn-search:disabled,
.motopoint-selector-header .motopoint-btn-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Current selection display */
#motopoint-selector .motopoint-current,
.motopoint-selector-header .motopoint-current {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

#motopoint-selector .motopoint-current > i,
.motopoint-selector-header .motopoint-current > i {
    font-size: 20px;
    color: #fff;
}

#motopoint-selector .motopoint-selection-text,
.motopoint-selector-header .motopoint-selection-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

#motopoint-selector .motopoint-btn-change,
#motopoint-selector .motopoint-btn-clear,
.motopoint-selector-header .motopoint-btn-change,
.motopoint-selector-header .motopoint-btn-clear {
    padding: 8px 15px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

#motopoint-selector .motopoint-btn-change:hover,
.motopoint-selector-header .motopoint-btn-change:hover {
    background: rgba(255, 255, 255, 0.2);
}

#motopoint-selector .motopoint-btn-clear,
.motopoint-selector-header .motopoint-btn-clear {
    border-color: #fff;
}

#motopoint-selector .motopoint-btn-clear:hover,
.motopoint-selector-header .motopoint-btn-clear:hover {
    background: #fff;
    color: #c0392b;
}

/* Responsive - stack on mobile */
@media (max-width: 991px) {
    #motopoint-selector .motopoint-row,
    .motopoint-selector-header .motopoint-row {
        flex-wrap: wrap;
    }
    
    #motopoint-selector .motopoint-field,
    .motopoint-selector-header .motopoint-field {
        flex: 1 1 calc(50% - 5px);
        min-width: calc(50% - 5px);
    }
    
    #motopoint-selector .motopoint-field-wide,
    .motopoint-selector-header .motopoint-field-wide {
        flex: 1 1 100%;
    }
    
    #motopoint-selector .motopoint-field-btn,
    .motopoint-selector-header .motopoint-field-btn {
        flex: 1 1 100%;
    }
    
    #motopoint-selector .motopoint-btn-search,
    .motopoint-selector-header .motopoint-btn-search {
        width: 100%;
    }
}

@media (max-width: 575px) {
    #motopoint-selector .motopoint-field,
    .motopoint-selector-header .motopoint-field {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    #motopoint-selector .motopoint-container,
    .motopoint-selector-header .motopoint-container {
        padding: 0 10px;
    }
}


/* ============================================
   SIDEBAR SELECTOR - VERTICAL
   ============================================ */

.motopoint-selector-sidebar {
    background: #fff;
    /* Requested: thin border around the entire sidebar block */
    border: 1px solid #2c3e50;
    border-radius: 0;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.motopoint-selector-sidebar .title_block {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 12px 15px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
}

.motopoint-selector-sidebar .title_block i {
    margin-right: 8px;
    color: #e94560;
}

.motopoint-selector-sidebar .block_content {
    padding: 15px;
}

.motopoint-selector-sidebar .form-group {
    margin-bottom: 12px;
}

.motopoint-selector-sidebar .form-group:last-child {
    margin-bottom: 0;
}

.motopoint-selector-sidebar label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.motopoint-selector-sidebar .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #2c3e50;
    border-radius: 0;
    font-size: 14px;
    transition: border-color 0.2s;
}

.motopoint-selector-sidebar .form-control:focus {
    outline: none;
    border-color: #2c3e50;
}

.motopoint-selector-sidebar .form-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.motopoint-selector-sidebar .btn-motopoint-search {
    width: 100%;
    padding: 12px;
    background: #2c3e50 !important;
    color: #fff !important;
    border: 1px solid #2c3e50 !important;
    border-radius: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.motopoint-selector-sidebar .btn-motopoint-search:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.motopoint-selector-sidebar .btn-motopoint-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Current selection in sidebar */
.motopoint-selector-sidebar .motopoint-current-selection {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 4px;
}

.motopoint-selector-sidebar .selection-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.motopoint-selector-sidebar .selection-label {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.motopoint-selector-sidebar .selection-actions {
    display: flex;
    gap: 8px;
}

.motopoint-selector-sidebar .selection-actions .btn {
    flex: 1;
    padding: 6px 10px;
    font-size: 12px;
}


/* ============================================
   LOADING STATES
   ============================================ */

.motopoint-select.loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 50 50'%3E%3Cpath fill='%23e94560' d='M25,5A20,20,0,1,1,5,25,20,20,0,0,1,25,5m0-5A25,25,0,1,0,50,25,25,25,0,0,0,25,0Z' opacity='.3'/%3E%3Cpath fill='%23e94560' d='M25,5A20,20,0,0,1,45,25h5A25,25,0,0,0,25,0Z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
    background-position: right 10px center;
    background-size: 16px 16px;
}


/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.motopoint-selector-header,
.motopoint-selector-sidebar {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   PRODUCT LISTING COMPATIBILITY HEADINGS
   ============================================ */

/* ===== Headings in listing ===== */
.motopoint-listing-heading {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin: 12px 0;
/*    border-radius: 4px; */
    font-weight: 600;
    line-height: 1.3;
	border: 1px solid rgba(0, 125, 19, 1);
	background: rgba(0, 125, 19, 1);
	color: #ffffff;
}

.motopoint-listing-empty-compat {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin: -6px 0 12px;
	border-left: 3px solid #c0392b;
}

.motopoint-listing-heading-wrap,
.motopoint-listing-heading,
.motopoint-no-compat{
  width: 100% !important;
  flex: 0 0 100% !important;
  max-width: 100% !important;
  display: block !important;
  clear: both;
  grid-column: 1 / -1;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  cursor: text;
}

/* ===== MotoPoint: Sidebar selector design (AngarTheme-safe) ===== */
.motopoint-selector-sidebar,
.motopoint-selector--sidebar {
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.motopoint-selector-sidebar .block_content,
.motopoint-selector--sidebar .block_content,
.motopoint-selector--sidebar .motopoint-selector-inner {
  background: #fff;
  color: #2c3e50;
  border: 1px solid #2c3e50;
  padding: 12px;
  box-sizing: border-box;
}

.motopoint-selector--sidebar .motopoint-sidebar-title,
.motopoint-selector-sidebar .motopoint-sidebar-title {
  background: #c0392b;
  color: #fff;
  padding: 10px 12px;
  margin: 0 0 0 0;
  font-weight: 700;
  border-radius: 0;
}

.motopoint-selector--sidebar select,
.motopoint-selector-sidebar select,
.motopoint-selector--sidebar .form-control,
.motopoint-selector-sidebar .form-control {
  border: 1px solid #2c3e50;
  color: #2c3e50;
  background: #fff;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.motopoint-selector--sidebar .motopoint-search-btn,
.motopoint-selector-sidebar .motopoint-search-btn {
  background: #2c3e50;
  color: #fff;
  border: 1px solid #2c3e50;
}

.motopoint-selector--sidebar .motopoint-search-btn:hover,
.motopoint-selector-sidebar .motopoint-search-btn:hover {
  opacity: 0.95;
}

/* ===== MotoPoint: Header selector should not cover cart dropdown ===== */
.motopoint-selector-header,
.motopoint-selector--header {
  position: relative;
  z-index: 1;
}

#header .blockcart,
#header .blockcart .dropdown-menu,
#header .cart-preview,
#header .shopping-cart {
  z-index: 9999 !important;
  position: relative;
}

/* ============================================
   SIDEBAR SELECTOR - ANGARTHEME OVERRIDES
   Ensures the sidebar selector stays within the sidebar width and uses requested colors.
   ============================================ */

#motopoint-selector-sidebar {
    box-sizing: border-box;
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: 1px solid #2c3e50 !important;
}

/* Also apply styles by class (some themes may override ID styles or remove them). */
.motopoint-selector-sidebar {
    border: 1px solid #2c3e50 !important;
    box-sizing: border-box;
}

.motopoint-selector-sidebar .motopoint-sidebar-title {
    border-radius: 0 !important;
}

.motopoint-selector-sidebar .btn-motopoint-search,
.motopoint-selector-sidebar #btn-motopoint-search {
    background: #2c3e50 !important;
    border-color: #2c3e50 !important;
    color: #ffffff !important;
}

#left-column #motopoint-selector-sidebar,
#right-column #motopoint-selector-sidebar,
.column #motopoint-selector-sidebar,
.sidebar #motopoint-selector-sidebar {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

#motopoint-selector-sidebar .motopoint-sidebar-title {
    background: #c0392b !important;
    color: #ffffff !important;
    padding: 10px 12px !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

#motopoint-selector-sidebar .block_content {
    background: #ffffff !important;
    color: #2c3e50 !important;
    border: 0 !important;
    padding: 12px !important;
}

#motopoint-selector-sidebar label {
    color: #2c3e50 !important;
}

#motopoint-selector-sidebar .form-control,
#motopoint-selector-sidebar select,
#motopoint-selector-sidebar input {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    background: #ffffff !important;
    color: #2c3e50 !important;
    border: 1px solid #2c3e50 !important;
}

#motopoint-selector-sidebar .btn-motopoint-search,
#motopoint-selector-sidebar #btn-motopoint-search {
    background: #2c3e50 !important;
    border-color: #2c3e50 !important;
    color: #ffffff !important;
}

#motopoint-selector-sidebar .btn-motopoint-search:hover:not(:disabled),
#motopoint-selector-sidebar #btn-motopoint-search:hover:not(:disabled) {
    opacity: 0.95;
}


/* Compatibility badge on compatible products (listing + product page) */
.motopoint-compat-badge-anchor {
  position: relative !important;
}

.motopoint-compat-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: #72c279;
  color: #ffffff;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 2px;
  z-index: 6;
  max-width: calc(100% - 16px);
}

.motopoint-badge-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Product page: badge bottom-right */
.images-container .product-cover.motopoint-compat-badge-anchor .motopoint-compat-badge,
.product-cover.motopoint-compat-badge-anchor .motopoint-compat-badge {
  right: 8px;
  bottom: 8px;
  left: auto;
  top: auto;
}

.motopoint-is-compat .thumbnail-container {
  /* Use inset shadow so layout does not shift */
  box-shadow: inset 0 0 0 1px #72c279;
}

/* Flags badges (listing + product page) */
.motopoint-flags-list,
.motopoint-flags-product {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.motopoint-flag {
  display: inline-block;
  padding: 3px 6px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.motopoint-flags-product {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 7;
  flex-direction: column;
  align-items: flex-end;
}

.motopoint-flags-product.motopoint-flags-with-compat {
  bottom: 34px;
}
