/**
 * Europecar Search Form Styles
 * Custom styling for the Europecar search form
 */

/* Container */
.europecar-search-container {
    background-color: #ffffff;
    border-radius: 20px;
    padding: 30px 40px;
    color: #ffffff;
    font-family: 'Arial', sans-serif;
    max-width: 100%;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Title */
.europecar-search-title {
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 25px 0;
    padding: 0;
    text-align: left;
}

/* Section titles */
.section-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding: 0;
    text-align: left;
}

/* Form Layout */
.europecar-search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-form-section {
    margin-bottom: 25px;
}

.search-form-row {
    display: flex;
    gap: 15px;
    width: 100%;
}

.location-row, .date-time-row {
    display: flex;
    gap: 15px;
}

.form-group {
    flex: 1;
    position: relative;
}

/* Input Fields */
.location-input,
.time-select {
    width: 100%;
    padding: 12px 15px;
    background-color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-size: 16px;
    color: #333333;
    height: 50px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6"><path d="M0 0l6 6 6-6z" fill="%23333333"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 30px;
}

.location-input::placeholder {
    color: #999999;
}

/* Date Fields */
.date-field {
    position: relative;
    width: 100%;
    background-color: #ffffff;
    border-radius: 5px;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    cursor: pointer;
}

.date-field input[type="date"] {
    width: 100%;
    height: 100%;
    padding: 0 15px;
    background-color: transparent;
    border: none;
    font-size: 16px;
    color: #333333;
    cursor: pointer;
    z-index: 2;
}

.date-display {
    position: absolute;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 1;
}

.date-display:before {
    content: "📅";
    margin-right: 10px;
    font-size: 16px;
}

/* Calendar customization */
input[type="date"]::-webkit-calendar-picker-indicator {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* Fix for Firefox date picker */
@-moz-document url-prefix() {
    .date-field input[type="date"] {
        opacity: 0.01; /* Firefox needs a tiny bit of opacity to work */
    }
}

/* Fix for Edge/IE date picker */
_:-ms-fullscreen, :root .date-field input[type="date"] {
    opacity: 0.01;
}

/* Time Selection */
.time-select {
    background-color: #ffffff;
    color: #333333;
    border: none;
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6"><path d="M0 0l6 6 6-6z" fill="%23333333"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 30px;
}

/* Submit Button */
.search-submit {
    background-color: #FDD835;
    color: #333333;
    border: none;
    border-radius: 5px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    width: auto;
    align-self: flex-end;
}

.search-submit:hover {
    background-color: #FFEB3B;
}

/* Error Messages */
.date-error-message,
.form-error-message {
    color: #f44336;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .europecar-search-container {
        padding: 20px;
    }
    
    .search-form-row,
    .location-row,
    .date-time-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-group {
        width: 100%;
    }
    
    .search-submit {
        width: 100%;
    }
}

/* Dark theme specific adjustments */
.europecar-search-container {
    background-color: #ffffff;
}

.search-submit {
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Focus states */
.location-input:focus,
.time-select:focus {
    outline: 2px solid #FDD835;
}

/* Date field styling */
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* Disabled fields */
.date-field.disabled {
    background-color: #f1f1f1;
    cursor: not-allowed;
}

input[type="date"]:disabled + .date-display {
    color: #999999;
}

.pickup-date-display,
.return-date-display {
    font-weight: 500;
}

/* Custom placeholder styling */
select option {
    background-color: #ffffff;
    color: #333333;
}

.submit-row {
    margin-top: 25px;
    justify-content: flex-end;
}

/* Calendar customization */
::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="15" viewBox="0 0 24 24"><path d="M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V10h16v11zM4 8V5h16v3H4z" fill="%23333333"/></svg>');
}

/* Main Container */
.europecar-search-container {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 1240px;
    margin: 0 auto 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Title */
.europecar-search-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 25px;
    color: #222;
}

/* Form Layout */
.europecar-search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.europecar-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    width: 100%;
}

.europecar-locations-row {
    margin-bottom: 10px;
}

/* Form Groups */
.europecar-form-group {
    flex-grow: 1;
    position: relative;
    min-width: 200px;
}

.europecar-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #222;
    font-size: 14px;
}

/* Input fields */
.europecar-location-wrapper {
    position: relative;
}

.location-search {
    width: 100%;
    height: 48px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 15px;
    font-size: 15px;
    background-color: #fff;
    color: #333;
    transition: border-color 0.2s ease;
}

.location-search:focus {
    border-color: #fbc02d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(251, 192, 45, 0.2);
}

/* Date and Time styles */
.europecar-date-time-container {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    height: 48px;
    position: relative;
}

.europecar-date-wrapper {
    position: relative;
    flex-grow: 1;
    border-right: 1px solid #ddd;
    cursor: pointer;
    overflow: visible; /* Allow the native date picker to extend beyond */
}

.europecar-date-wrapper input[type="date"] {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
    padding: 0;
    border: none;
    /* Ensure the input receives clicks */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Visible at least 1px to handle click events better */
.europecar-date-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0.0001; /* Almost invisible but still there */
    z-index: 3;
    background: transparent;
}

/* Make the date picker cover the whole input for better touch targets */
.europecar-date-wrapper input[type="date"]::-webkit-inner-spin-button,
.europecar-date-wrapper input[type="date"]::-webkit-clear-button {
    display: none;
}

/* For Firefox and others */
.europecar-date-wrapper input[type="date"]::-moz-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    opacity: 0.0001; /* Almost invisible but still there */
    z-index: 3;
}

.europecar-date-display {
    display: flex;
    align-items: center;
    padding: 0 15px;
    height: 100%;
    font-size: 15px;
    color: #333;
    position: relative;
    z-index: 1;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    user-select: none;  /* Prevent highlighting */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Add calendar icon to date display */
.europecar-date-display::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path d='M20 3h-1V1h-2v2H7V1H5v2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 18H4V8h16v13z' fill='%23666'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.europecar-time-wrapper {
    width: 120px;
}

.europecar-time-wrapper select {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0 10px;
    font-size: 15px;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1L5 5L9 1' stroke='%23333' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

/* Search Button */
.europecar-submit-button {
    min-width: 120px;
}

.europecar-search-submit {
    width: 100%;
    height: 48px;
    background-color: #fbc02d;
    color: #222;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.europecar-search-submit:hover {
    background-color: #f9a825;
}

/* Location search results */
.location-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
    scrollbar-width: thin;
    display: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.location-results.active {
    display: block;
    animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.location-results:empty {
    display: none;
}

.location-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: flex-start;
    position: relative;
}

.location-item:last-child {
    border-bottom: none;
}

.location-item:hover, 
.location-item.active {
    background-color: #f5f7fa;
}

.europecar-search-dark .location-item:hover,
.europecar-search-dark .location-item.active {
    background-color: #444;
}

.europecar-search-primary .location-item:hover,
.europecar-search-primary .location-item.active {
    background-color: rgba(251, 192, 45, 0.1);
}

.location-item:focus-visible {
    outline: 2px solid #0078d7;
    outline-offset: -2px;
}

.location-icon {
    margin-right: 12px;
    color: #666;
    font-size: 16px;
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 3px;
}

.location-item.active .location-icon {
    color: #fbc02d;
}

.europecar-search-dark .location-item.active .location-icon {
    color: #fbc02d;
}

.europecar-search-primary .location-item.active .location-icon {
    color: #0078d7;
}

.location-details {
    flex: 1;
}

.location-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    display: block;
}

.location-item.active .location-name {
    color: #111;
}

.location-code {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
    display: inline-block;
}

.location-address {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
    display: block;
}

/* No results and error states */
.no-results,
.search-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-error {
    color: #e53935;
}

/* Loading indicator animation */
.loading-indicator {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: none;
    color: #fbc02d;
    font-size: 18px;
    animation: spin 1s infinite linear;
    z-index: 5;
}

/* Custom scrollbar for location results */
.location-results::-webkit-scrollbar {
    width: 6px;
}

.location-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.location-results::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.location-results::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Location icon specific styles */
.location-icon.airport i::before {
    content: "\f072"; /* Plane icon */
}

.location-icon.station i::before {
    content: "\f238"; /* Train icon */
}

.location-icon.city i::before {
    content: "\f1ad"; /* Building icon */
}

.location-icon.hotel i::before {
    content: "\f236"; /* Hotel/bed icon */
}

.location-icon.default i::before {
    content: "\f3c5"; /* Map marker icon */
}

/* Dark theme specific overrides for location results */
.europecar-search-dark .location-results {
    background-color: #333;
    border-color: #444;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.europecar-search-dark .location-item {
    border-bottom-color: #444;
}

.europecar-search-dark .location-item:hover,
.europecar-search-dark .location-item:focus {
    background-color: #3a3a3a;
}

.europecar-search-dark .location-name {
    color: #f0f0f0;
}

.europecar-search-dark .location-code {
    background-color: #444;
    color: #ddd;
}

.europecar-search-dark .location-address,
.europecar-search-dark .location-type {
    color: #bbb;
}

/* Primary theme specific overrides for location results */
.europecar-search-primary .location-results {
    border-color: #0078d7;
}

.europecar-search-primary .location-item:focus-visible {
    outline-color: #0078d7;
}

.europecar-search-primary .location-name {
    color: #0078d7;
}

/* Responsive adjustments for location results */
@media (max-width: 768px) {
    .location-results {
        max-height: 250px;
    }
    
    .location-item {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .location-icon {
        margin-right: 8px;
    }
    
    .location-address {
        font-size: 12px;
    }
}

/* Location loading and errors */
.location-loading {
    padding: 15px;
    text-align: center;
    color: #666;
}

.location-loading i {
    margin-right: 5px;
    animation: spin 1s infinite linear;
}

.location-error {
    padding: 15px;
    text-align: center;
    color: #e74c3c;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Clear location button */
.clear-location {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    display: none;
    background: none;
    border: none;
    padding: 0;
    width: 20px;
    height: 20px;
    line-height: 1;
    font-size: 16px;
}

.clear-location:hover {
    color: #333;
}

.has-value .clear-location {
    display: block;
}

/* Input with location selected */
.location-input-wrapper.has-value input {
    padding-right: 30px;
}

/* Error messages */
.error-message {
    color: #d32f2f;
    font-size: 14px;
    margin-top: 8px;
    display: none;
}

/* Responsive styles */
@media (max-width: 768px) {
    .europecar-search-container {
        padding: 20px;
    }
    
    .europecar-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .europecar-date-time-container {
        flex-direction: column;
        height: auto;
        border: none;
    }
    
    .europecar-date-wrapper, 
    .europecar-time-wrapper {
        border: 1px solid #ddd;
        border-radius: 8px;
        height: 48px;
        width: 100%;
    }
    
    .europecar-date-wrapper {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .europecar-search-container {
        padding: 15px;
    }
    
    .europecar-search-title {
        font-size: 20px;
    }
}

/* Icon Font */
@font-face {
    font-family: 'Europecar-Icons';
    src: url('../fonts/europecar-icons.woff2') format('woff2'),
         url('../fonts/europecar-icons.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

[class^="icon-"], [class*=" icon-"] {
    font-family: 'Europecar-Icons' !important;
    speak: never;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fallback icons (if icon font is not available) */
.icon-plane:before {
    content: "✈";
}

.icon-train:before {
    content: "🚆";
}

.icon-building:before {
    content: "🏢";
}

.icon-hotel:before {
    content: "🏨";
}

.icon-map-marker:before {
    content: "📍";
}

/* Error states */
.form-group input.error,
.form-group select.error {
    border-color: #e53935;
    box-shadow: 0 0 0 1px #e53935;
}

/* Location input styling */
.europecar-search-form .location-input-wrap {
    position: relative;
    flex: 1;
}

.europecar-search-form .location-input {
    width: 100%;
    padding-right: 30px; /* Space for clear button */
}

/* Clear location button */
.europecar-search-form .clear-location {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 16px;
    z-index: 10;
    transition: color 0.2s ease;
}

.europecar-search-form .clear-location:hover {
    color: #e74c3c;
}

/* Location results styling */
.location-results {
    position: absolute;
    z-index: 1000;
    width: 100%;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.location-results.active {
    display: block;
}

.location-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.location-item:last-child {
    border-bottom: none;
}

.location-item:hover {
    background-color: #f9f9f9;
}

.location-item i {
    margin-right: 10px;
    color: #666;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.location-item-content {
    flex: 1;
}

.location-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.location-code {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-left: 5px;
    color: #666;
}

.location-address {
    color: #777;
    font-size: 0.9em;
}

/* Static Location Dropdown Styles */
.europecar-search-container select.location-dropdown {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.europecar-search-container select.location-dropdown:focus {
    outline: none;
    border-color: #4a89dc;
    box-shadow: 0 0 0 2px rgba(74, 137, 220, 0.2);
}

.europecar-search-container select.location-dropdown:hover {
    border-color: #bbb;
}

.europecar-search-container .location-wrapper {
    position: relative;
    margin-bottom: 15px;
    width: 100%;
}

.europecar-search-container .location-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* Dark theme overrides for dropdowns */
.europecar-search-container.theme-dark select.location-dropdown {
    background-color: #2a2a2a;
    border-color: #444;
    color: #fff;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>');
}

.europecar-search-container.theme-dark select.location-dropdown:focus {
    border-color: #4a89dc;
    box-shadow: 0 0 0 2px rgba(74, 137, 220, 0.4);
}

.europecar-search-container.theme-dark select.location-dropdown:hover {
    border-color: #555;
}

/* Primary theme overrides for dropdowns */
.europecar-search-container.theme-primary select.location-dropdown {
    border-color: #3498db;
}

.europecar-search-container.theme-primary select.location-dropdown:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.3);
}

/* Responsive Styles for Dropdowns */
@media (max-width: 768px) {
    .europecar-search-container select.location-dropdown {
        padding: 10px 12px;
        font-size: 13px;
        background-size: 16px;
    }
}

@media (max-width: 480px) {
    .europecar-search-container select.location-dropdown {
        padding: 10px 12px;
        font-size: 13px;
        background-size: 16px;
    }
} 