/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

/* --- CSS Reset to Ensure Theme Independence --- */
.xevato-search-widget *,
.xevato-search-widget *::before,
.xevato-search-widget *::after,
.xevato-modal *,
.xevato-modal *::before,
.xevato-modal *::after {
    box-sizing: border-box;
}

/* --- Main Widget --- */
.xevato-search-widget {
    background-color: #1f1f1f; /* Darker modern background matching screenshots */
    color: #fff;
    padding: 25px;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 650px !important;
    margin: 20px auto;
    line-height: 1.5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.xevato-search-heading {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    line-height: 1.2;
}

.xevato-search-subheading {
    margin-top: -10px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
}

.xevato-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffffff;
    font-weight: normal;
}

.xevato-info-icon {
    display: inline-block;
    border: 1px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 12px;
    cursor: pointer;
    margin-left: 5px;
}

.xevato-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid #555;
    border-radius: 4px;
    overflow: hidden;
    background-color: #ffffff;
    height: 51px; /* Explicit height for consistency */
}

.xevato-input-flag {
    background-image: url('../images/SE.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 25px;
    flex-shrink: 0;
    border-radius: 0;
}

.xevato-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    background-color: #fff;
    color: #333;
    font-size: 22px;
    margin: 0;
    height: 100%; /* Fill the container height */
    line-height: normal;
    text-transform: uppercase;
    box-shadow: none !important;
    border-radius: 0; /* Remove theme-induced radius */
}

.xevato-input:focus {
    outline: none;
}

#xevato-regno-input {
    height: 51px;
}

.xevato-button {
    background-color: #f58220;
    color: #fff;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0;
}

.xevato-button:hover {
    background-color: #e07014;
}

.xevato-button .xevato-button-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="white"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

.xevato-toggle-link {
    display: inline-block;
    margin-top: 15px;
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.xevato-toggle-link:hover {
    opacity: 0.8;
}

/* Modal Styles */
.xevato-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
}

.xevato-modal-content {
    background-color: #fefefe;
    color: #333;
    border: none;
    width: 90%;
    max-width: 600px;
    border-radius: 5px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.xevato-modal-header {
    background-color: #333;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.xevato-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    line-height: 1.2;
}

.xevato-modal-close {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.xevato-modal-close:hover {
    color: #ccc;
}

.xevato-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.xevato-modal-body p {
    margin-bottom: 1em;
    margin-top: 0;
}

/* Success Bar Styles */
.xevato-success-bar {
    background-color: #e9e6e0;
    color: #333;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    border-radius: 4px;
    font-family: inherit;
    animation: xevato-fade-in 0.4s ease-out;
    gap: 15px;
}

.xevato-success-bar-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1;
}

.xevato-success-icon {
    width: 24px;
    height: 24px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="%234CAF50"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>');
    background-size: contain;
    flex-shrink: 0;
}

.xevato-success-bar-text {
    flex: 1;
}

.xevato-success-bar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin-left: 20px;
    flex-shrink: 0;
}

.xevato-success-bar-actions a {
    color: #333;
    text-decoration: underline;
    cursor: pointer;
}

/* Vehicle Details Modal Styles */
.xevato-details-grid {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 15px;
    margin-top: 15px;
}

.xevato-details-grid dt {
    font-weight: bold;
}

.xevato-details-grid dd {
    margin: 0;
}

.xevato-details-section-title {
    grid-column: 1 / -1;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 20px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}
.xevato-details-section-title:first-child {
    margin-top: 0;
}

/* Manual Selector Styles (inside modal) */
.xevato-form-manual-modal {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.xevato-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.xevato-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.xevato-form-group-full {
    flex-basis: 100%;
}

.xevato-form-manual-modal label {
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.xevato-select {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    margin: 0;
}

.xevato-select:disabled {
    background-color: #f2f2f2;
    cursor: not-allowed;
}

/* --- Manual Search Form Layout --- */
.xevato-form-manual {
    margin-top: 20px;
    margin-bottom: 10px;
}

.xevato-manual-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.xevato-manual-row .xevato-select {
    flex: 1;
    min-width: 120px;
}

@media (max-width: 500px) {
    .xevato-manual-row {
        flex-direction: column;
        gap: 10px;
    }
}

/* --- Additional Responsive Adjustments --- */
@media (max-width: 620px) {
    /* Stack success bar content for a cleaner look */
    .xevato-success-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .xevato-success-bar-actions {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        margin-top: 15px;
    }

    /* Stack dropdowns in the "Not Found" modal */
    .xevato-form-row {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 420px) {
    /* Hide button text on very small screens, leaving only the icon */
    #xevato-regno-submit .xevato-button-text {
        display: none;
    }
    #xevato-regno-submit {
        padding: 10px 12px;
        justify-content: center;
    }
}

/* --- Animations & Loading States --- */
@keyframes xevato-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.xevato-button.is-loading .xevato-button-icon {
    background-image: none !important;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: xevato-spin 0.6s linear infinite;
}

@keyframes xevato-fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}