/* ========== Base Styling ========== */
body {
    font-family: "Roboto", sans-serif;
    margin: 0;
    padding: 0;
    background-color: white;
    color: #333;
}

/* ========== Container Layouts ========== */
/* Container styles moved to layout.css */

/* JSON container specific styling */
.json-container {
    background-color: #F2F0FE;
    color: #fff;
    text-align: center;
}

/* ========== Headings ========== */
.json-container h3 {
    text-align: center;
}

.form-container h3 {
    text-align: left;
}

/* ========== Form Elements ========== */
.form-group {
    margin-bottom: 15px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    text-align: left;
}

.validation-message {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.validation-message.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.coming-soon-message {
    display: block;
    margin-top: 12px;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    background-color: #fff3cd;
    color: #856404;
    text-align: center;
    border: 1px solid #ffeaa7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Dutch license plate styling */
#licenseInput {
    background-color: #FDD835 !important;
    color: #000000 !important;
    font-family: 'Courier New', Courier, monospace !important;
    font-weight: bold !important;
    font-size: 20px !important;
    letter-spacing: 2px !important;
    text-align: center !important;
    text-transform: uppercase !important;
    border: 3px solid #000000 !important;
    border-radius: 4px !important;
    padding: 12px 10px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

#licenseInput:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#licenseInput::placeholder {
    color: rgba(0, 0, 0, 0.4) !important;
    letter-spacing: 2px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.inline-group input[type="text"] {
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.inline-group input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.form-group input[type="email"].validating,
.form-group input[type="tel"].validating {
    border-color: #6094db;
    box-shadow: 0 0 0 3px rgba(96, 148, 219, 0.15);
}

.form-group input[type="email"].valid,
.form-group input[type="tel"].valid {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.form-group input[type="email"].invalid,
.form-group input[type="tel"].invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

input[type="submit"] {
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

input[type="submit"]:hover {
    background-color: #0056b3;
}

/* ========== Search Field ========== */
#search {
    font-size: 16px;
    border: 1px solid #d1d1d1;
    border-radius: 6px;
    padding: 10px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

#search:focus {
    border-color: #6094db;
    box-shadow: 0 0 0 3px rgba(96, 148, 219, 0.15);
    transform: translateY(-1px);
}

#search.searching {
    border-color: #6094db;
    box-shadow: 0 0 0 3px rgba(96, 148, 219, 0.15);
}

#search.has-results {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* ========== Search Results ========== */
#results {
    max-height: 300px;
    overflow-y: auto;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 6px 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: -1px;
    width: 100%;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#results.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#results:empty {
    display: none;
}

.group-heading {
    background-color: #614af4;
    color: #ffffff;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 14px;
    border-bottom: 1px solid #e0e0e0;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f5f9ff;
    padding-left: 18px;
    box-shadow: inset 4px 0 0 #007bff;
}

.suggestion-item:active {
    background-color: #e8f4ff;
    transform: scale(0.98);
}

.highlight {
    background-color: #ffeb3b;
    font-weight: bold;
}

/* ========== Custom Dropdown Select ========== */
.select-selected {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
}

.select-items {
    padding: 0;
    display: none;
    position: absolute;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 99;
    top: 60%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
}

.select-selected {
    position: relative;
}

.select-selected:hover {
    border-color: #007bff;
}

.select-selected::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #999;
}

.select-items.show {
    display: block;
}

.select-items li {
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #fff;
}

.select-items li:hover {
    background-color: #f1f1f1;
}

.flag-icon {
    width: 25px;
    height: 15px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center center;
}

/* ========== Scrollbar Styling ========== */
.custom-select .select-items::-webkit-scrollbar {
    background: white;
    width: 8px;
}

.custom-select .select-items::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.custom-select .select-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========== Inline Address Fields ========== */
.inline-group {
    display: flex;
    gap: 5px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.inline-group > div {
    flex: 1;
    margin-right: 20px;
    flex-shrink: 0;
    min-width: 120px;
}

.inline-group label {
    display: block;
    width: 100%;
    text-align: left;
}

/* Ensure all inline-group inputs get styled (type attribute may be removed in production) */
.inline-group input {
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.inline-group input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.inline-group input[id="postalcode"] {
    text-transform: uppercase;
}

/* ========== Clear Button for Search ========== */
#clearSearchButton {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
}

#clearSearchButton:hover {
    color: #333;
}

/* ========== Address Fields Toggle ========== */
#addressFields {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#addressFields.show {
    display: block !important;
    opacity: 1;
    transform: translateY(0);
}

input[readonly] {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

/* Address field animation on value change */
.form-group input.flash-success {
    animation: flashGreen 0.6s ease;
}

@keyframes flashGreen {
    0% {
        background-color: #d4edda;
        transform: scale(1);
    }
    50% {
        background-color: #c3e6cb;
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* ========== Error Message Styling ========== */
.noaddressfoundmessage {
    display: none;
    padding: 12px 16px;
    font-weight: 500;
    border-radius: 6px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
}

/* ========== Lookup Options ========== */
.lookup-options {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lookup-options.show {
    opacity: 1;
    transform: translateY(0);
}

.options-header {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

.option-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.option-row:first-of-type {
    padding-top: 0;
}

.option-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    cursor: pointer;
}

.option-label span {
    font-weight: 500;
    font-size: 15px;
    color: #333;
}

.option-label small {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* ========== Toggle Switch ========== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 26px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #007bff;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Old switch styles (keeping for compatibility) */
.switch-container {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.switch-label {
    font-weight: bold;
}

.switch {
    display: inline-block;
    width: 50px;
    height: 25px;
    background-color: grey;
    border-radius: 25px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
}

.switch-handle {
    width: 23px;
    height: 23px;
    background-color: white;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: left 0.3s;
}

.switch.active {
    background-color: lightgreen;
}

.switch.active .switch-handle {
    left: calc(100% - 26px);
}

/* ========== Rocket Placeholder Image ========== */
.placeholderImage {
    padding-top: 40px;
    padding-bottom: 10px;
}

/* ========== JSON Output Styling ========== */
#jsonOutput {
    display: none;
    font-family: monospace;
    white-space: pre;
    background-color: #f4f4f4;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-x: auto;
    color: black;
    text-align: left;
    font-size: 13px;
    line-height: 18px;
}

#jsonOutput .key {
    color: brown;
}

#jsonOutput .string {
    color: green;
}

#jsonOutput .number {
    color: darkblue;
}

#jsonOutput .boolean {
    color: navy;
}

#jsonOutput .null {
    color: magenta;
}

/* ========== Spinner Animation ========== */
.spinner {
    display: none;
    position: absolute;
    top: 50%;
    right: 15px;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-top: 3px solid #6094db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%) rotate(0deg);
    pointer-events: none;
}

.spinner.show {
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }
    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Email and phone spinner specific positioning */
#emailLoadingSpinner,
#phoneLoadingSpinner {
    right: 15px;
}

/* Search spinner with clear button */
#loadingSpinner {
    right: 35px; /* make room for clear button */
}

/* ========== Input Field Wrapping (Spinner + Clear Button) ========== */
.input-wrapper {
    position: relative;
}

.input-wrapper input[type="text"],
.input-wrapper input#search {
    padding-right: 60px; /* space for spinner and clear button */
}

.input-wrapper input[type="email"],
.input-wrapper input[type="tel"] {
    padding-right: 45px; /* space for spinner only */
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .inline-group {
        flex-direction: column;
    }

    .inline-group > div {
        margin-right: 0;
        width: 100%;
    }

    .form-container {
        padding: 10px;
    }

    .form-group input[type="text"] {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Match form input styling */
select,
input[type="text"],
input[type="email"],
input[type="tel"] {
    font-size: 16px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

/* Match focus style */
select:focus,
input:focus {
    border-color: #007bff;
    outline: none;
}

/* Optional: reduce default browser arrow size on some browsers */
select {
    appearance: none;
    background-color: white;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20fill%3D'%236094db'%20viewBox%3D'0%200%2024%2024'%20xmlns%3D'http://www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M7%2010l5%205%205-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    padding-right: 40px;
    cursor: pointer;
}

.select-items .group-label {
    padding: 8px 16px;
    font-weight: bold;
    background-color: #614af4;
    color: #ffffff;
    cursor: default;
    pointer-events: none;
    border-top: 1px solid #ccc;
}

/* ========== Phone Input Group ========== */
.phone-input-group {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.phone-country-select {
    flex-shrink: 0;
    width: 110px;
    font-size: 16px;
    padding: 10px 8px;
    border: 1px solid #d1d1d1;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.phone-country-select:focus {
    border-color: #6094db;
    box-shadow: 0 0 0 3px rgba(96, 148, 219, 0.15);
}

.phone-input-wrapper {
    flex: 1;
    min-width: 0;
}
