/* NFP Car Filter Styles */

/* Car Filter Container */
.tcs-car-filter {
    width: 100%;
    max-width: 470px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 30px;
    background: #ffffff;
    border: 2px solid #1f1f1f;
}

.tcs-car-filter, .tcs-car-filter-wrapper{
    border-radius: 8px;
}

/* Dropdowns Container */
.tcs-car-filter__dropdowns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 768px) {
    .tcs-car-filter__dropdowns {
        flex-direction: column;
    }
}

/* Dropdown Styling */
.custom-dropdown {
    position: relative;
    flex: 1;
}

.custom-dropdown__inner {
    position: relative;
    width: 100%;
}

/* Dropdown trigger: looks like an input, but is a div/button */
.custom-dropdown__trigger {
    width: 100%;
    padding: 10px 14px 10px 14px;
    border: 2px solid #1f1f1f;
    border-radius: 4px;
    font-size: 16px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.2s;
    min-height: 44px;
    position: relative;
}

/* Always show the triangle arrow on the right side of the trigger */
.custom-dropdown__arrow {
    margin-left: 10px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #666;
    /* Visually align to the right */
    flex-shrink: 0;
}

.custom-dropdown__trigger:focus {
    outline: none;
}

.custom-dropdown__trigger-text {
    flex: 1;
    color: #1f1f1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Search input inside dropdown */
.custom-dropdown__search {
    width: calc(100% - 24px)!important; /* leave space for margin */
    padding: 8px 12px!important;
    border: 1px solid #ccc!important;
    border-radius: 4px!important;
    font-size: 15px;
    margin-bottom: 8px;
    margin-top: 8px;
    margin-left: 12px;  /* Add spacing to left */
    margin-right: 12px; /* Add spacing to right */
    box-sizing: border-box;
    outline: none;
    display: block;
}
.custom-dropdown__search:focus {
    border-color: #007cba;
}

/* Enable momentum scrolling on iOS and improve mobile touch scroll */
.custom-dropdown__options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 2px solid #1f1f1f;
    border-radius: 0px 0px 4px 4px;
    z-index: 1000;
    margin-top: -4px;
    -webkit-overflow-scrolling: touch; /* Allow smooth scrolling on iOS/mobile */
}

.custom-dropdown.active .custom-dropdown__options {
    display: block;
}

/* Regular dropdown item */
.custom-dropdown__item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #eee;
}

.custom-dropdown__item:hover {
    background-color: #1c1819;
    color: #fff;
}

/* Grid layout specifically for type dropdown */
.custom-dropdown[data-type="type"] .custom-dropdown__item {
    display: grid;
    grid-template-areas:
        "chassis year"
        "facelift bodystyle";
    grid-template-columns: 1fr 1fr;
    grid-gap: 4px;
    min-height: 64px;
    padding: 8px 14px;
}

.custom-dropdown__item:last-child {
    border-bottom: none;
}

/* Grid item components */
.custom-dropdown__item-chassis {
    grid-area: chassis;
    font-weight: 600;
    font-size: 14px;
    align-self: center;
}

.custom-dropdown__item-year {
    grid-area: year;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
    align-self: center;
}

.custom-dropdown__item-facelift {
    grid-area: facelift;
    font-size: 12px;
    color: #666;
    text-align: left;
    min-height: 18px;
    padding-top: 5px;
}

.custom-dropdown__item-bodystyle {
    grid-area: bodystyle;
    font-size: 12px;
    color: #666;
    text-align: right;
    min-height: 18px;
    padding-top: 5px;
}

/* Fix text color on hover */
.custom-dropdown__item:hover .custom-dropdown__item-facelift,
.custom-dropdown__item:hover .custom-dropdown__item-year,
.custom-dropdown__item:hover .custom-dropdown__item-bodystyle {
    color: #fff;
}

/* License Plate Lookup Styles */
.license-plate-lookup {
    align-content: stretch;
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: flex-start;
    position: relative; /* Ensure absolute children are positioned correctly */
}

.license-plate-lookup .search-row {
    display: flex;
    gap: 10px;
}

/* License plate blue background */
.licence-plate-blue {
    background: #003399;
    border-radius: 4px;
    border: 2px solid #1f1f1f;
    display: flex;
    padding-left: 32px;
    position: relative;
    text-align: center;
    height: 52px; /* 48px + 4px for borders */
    align-items: center;
    box-sizing: border-box;
}

.licence-plate-blue:before {
    bottom: 0px;
    color: #fff;
    content: attr(data-country);
    font-size: 14px;
    left: 15px;
    position: absolute;
    text-align: center;
    text-transform: uppercase;
    transform: translateX(-50%);
    width: 36px;
}

/* EU stars icon */
.license-plate-icon {
    height: 24px;
    left: 0px;
    position: absolute;
    top: 6px;
    width: 30px;
}

.license-plate-icon svg {
    height: 100%;
    width: 100%;
}

.eu-svg {
    fill: #ffcc00;
    height: 24px;
    width: 24px;
}

/* Input field */
input.license-input::placeholder {
    letter-spacing: normal;
    font-size: 18px;
    margin: auto;
}

input.license-input:focus {
    outline: none;
    border: 2px solid inherit;
}

input.license-input:-webkit-autofill {
    background-color: #ffcc00 !important;
    -webkit-box-shadow: 0 0 0px 1000px #ffcc00 inset !important;
    color: #000 !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    text-align: center !important;
}

input.license-input:-moz-autofill {
    background-color: #ffcc00 !important;
    color: #000 !important;
}

input.license-input {
    width: 210px !important;
    padding: 0;
    font-size: 24px;
    text-transform: uppercase;
    background: #ffcc00;
    color: #000;
    text-align: center;
    font-weight: bold;
    letter-spacing: 1px;
    font-family: "Roboto", sans-serif;
    height: 100%;
    line-height: 48px;
    border: none;
    margin: 0;
}

/* Search button */
.license-search-button {
    padding: 10px 5px;
    font-size: 16px;
    cursor: pointer;
    background: #1f1f1f;
    color: #ffffff;
    border: solid 2px #1f1f1f;
    font-family: "Roboto", sans-serif;
    height: 52px;
    box-sizing: border-box;
    border-radius: 4px;
    width: 95px;
    display: flex;               /* keep layout consistent to prevent jank */
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;         /* prevent text wrapping on narrow width */
}

.license-search-button:hover,
.license-search-button:focus {
    background-color: #000000;
    border: 2px solid #000000;
}

/* Loading state for search button */
.license-search-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.license-search-button.loading { pointer-events: none; }

/* CSS-driven spinner to avoid DOM rewrites */
.license-search-button.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    will-change: transform; /* smoother on desktop */
}

/* Spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Message container */
.message-container {
    padding: 10px;
    display: none;
    border-radius: 4px;
}

.message-error {
    background-color: #ffe6e6;
    color: #d63031;
    border: 1px solid #d63031;
}

.message-success {
    background-color: #e6ffe6;
    color: #27ae60;
    border: 1px solid #27ae60;
}

.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Selected Car Section */
.tcs-car-filter__top-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tcs-car-filter__selected-car {
    display: none;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 15px;
}

.tcs-car-filter__selected-car.active {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selected-car__details {
    font-weight: 500;
}

.tcs-car-filter__search-again {
    background-color: transparent;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 14px;
}

.tcs-car-filter__search-again:hover {
    background-color: #eee;
}

/* History Button and Dropdown */
.tcs-car-filter__history {
    position: relative;
    align-self: flex-end;
}

.tcs-car-filter__history-button {
    background-color: #1f1f1f;
    border: 2px solid #1f1f1f;
    border-radius: 4px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tcs-car-filter__history-button svg {
    width: 100%;
    height: 100%;
    fill: #ffffff;
    color: #ffffff;
}

.tcs-car-filter__history-button:hover,
.tcs-car-filter__history-button:focus {
    background-color: #000000;
    border: 2px solid #000000;
}

.tcs-car-filter__history-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 410px;
    background: #fff;
    border: 2px solid #1f1f1f;
    border-radius: 4px;
    z-index: 1000;
    margin-top: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    padding: 0;
}

.tcs-car-filter__history.active .tcs-car-filter__history-dropdown {
    display: block;
}

.tcs-car-filter__recent-items {
    max-height: 300px;
    overflow-y: auto;
}

.tcs-car-filter__recent-item {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 16px;
}

.tcs-car-filter__recent-item:hover {
    background-color: #1c1819;
    color: #fff;
}

.tcs-car-filter__recent-item:hover .nfp-history-plate,
.tcs-car-filter__recent-item:hover .nfp-history-car {
    color: #fff!important;
}

.tcs-car-filter__recent-item:last-child {
    border-bottom: none;
}

.tcs-car-filter__recent-empty {
    padding: 10px 14px;
    color: #888;
    font-size: 15px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .tcs-car-filter__selected-car {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .license-plate-lookup .search-row {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .licence-plate-blue {
        width: 100%;
    }

    #license-input {
        width: 100% !important;
    }
    
    .tcs-car-filter__history-dropdown {
        width: 275px;
    }
    
    .license-search-button {
        width: calc(100% - 62px);
    }

    .tcs-car-filter__divider-row {
        margin: 0 !important;
    }
}

/* Divider row between license plate and dropdowns */
.tcs-car-filter__divider-row {
    display: flex;
    align-items: center;
    margin: 10px 0;
    width: 100%;
    gap: 12px;
}
.tcs-car-filter__divider {
    flex: 1;
    height: 1px;
    background: #1f1f1f;
    border-radius: 4px;
}
.tcs-car-filter__divider-text {
    color: #1f1f1f;
    font-size: 15px;
    font-weight: 500;
    padding: 0 10px;
    letter-spacing: 1px;
}

/* Message container for license plate lookup error/success */
#license-message {
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    z-index: 10;
    margin-top: 4px;
    display: none;
}
#license-message.message-error,
#license-message.message-success {
    display: block !important; /* Always show when message is set */
}

.nfp-history-plate {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 2px;
  color: #222;
  display: block;
}
.nfp-history-car {
  font-size: 15px;
  color: #444;
  display: block;
} 
