.mgu-api-insurance-flow {
    max-width: 800px;
    margin: 2em auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 16px;
    color-scheme: light;
}

/* Contain floated steps */
.mgu-api-steps::after {
    content: "";
    display: block;
    clear: both;
}

.mgu-api-step {
    margin-bottom: 2em;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    box-sizing: border-box;
}

.mgu-api-step h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    margin-bottom: 1em;
}

.mgu-api-select {
    width: 100%;
    padding: 12px;
    margin-bottom: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.4;
    background-color: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Ensure selects look light (not dark grey) */
.mgu-api-select { color: #222; background-color: #ffffff !important; }
.mgu-api-select:disabled { background-color: #f5f5f5 !important; color: #888; }
.mgu-api-select { color-scheme: light; }

.mgu-api-select option {
    padding: 12px;
    font-size: 16px;
    line-height: 1.4;
}

.mgu-api-form .form-group {
    margin-bottom: 1.5em;
}

.mgu-api-form label {
    display: block;
    margin-bottom: 0.5em;
    color: #333;
    font-size: 1.1em;
}

.mgu-api-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Ensure equal heights for side-by-side inputs */
.mgu-form-row .mgu-api-input {
    height: 44px;
}

/* Normalize number input height by removing spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

.mgu-api-button {
    background: #0073aa;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

.mgu-api-button:hover {
    background: #005177;
}

.mgu-api-step-result {
    margin-top: 1em;
    padding: 15px;
    border-radius: 4px;
    font-size: 16px;
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    z-index: 1;
}

.mgu-api-step-result.success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.mgu-api-step-result.error {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.mgu-api-quote-details {
    margin: 1em 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mgu-api-quote-details h4 {
    margin-top: 0;
    color: #333;
}

.mgu-api-quote-details p {
    margin: 0.5em 0;
    color: #666;
}

.mgu-api-quote-options {
    margin: 1em 0;
}

.mgu-api-quote-option {
    margin-bottom: 1.5em;
    padding: 1.5em;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.mgu-api-quote-option.selected {
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.mgu-api-quote-option h4 {
    margin-top: 0;
    color: #333;
    font-size: 1.2em;
}

.mgu-api-quote-option .mgu-api-quote-details {
    margin-top: 1em;
}

.mgu-api-quote-option .mgu-api-quote-details p {
    margin: 0.5em 0;
    color: #666;
}

.mgu-api-quote-option .select-option {
    margin-top: 1em;
}

#accept-quote {
    display: none;
    margin-top: 1em;
}

/* Loading Spinner Styles */
.mgu-api-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: mgu-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Loading state for steps */
.mgu-api-step.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.mgu-api-step.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: mgu-spin 1s linear infinite;
    z-index: 10;
}

/* Loading text indicator */
.mgu-api-loading-text {
    display: inline-block;
    color: #0073aa;
    font-size: 14px;
    margin-left: 5px;
    font-style: italic;
}

/* Disable select while loading */
.mgu-api-select:disabled,
.mgu-api-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button loading state */
.mgu-api-button.loading {
    position: relative;
    color: transparent;
}

.mgu-api-button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: mgu-spin 1s linear infinite;
}

/* Ensure loss cover checkbox is always clickable */
#policy-loss-cover {
    pointer-events: auto !important;
    cursor: pointer !important;
}

#policy-loss-cover:disabled {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* CSS migrated from mgu-api-insurance-flow.php */
.mgu-api-insurance-flow {
    max-width: 800px;
    margin: 2em auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 16px;
}

.mgu-api-step {
    margin-bottom: 2em;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mgu-api-step h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    margin-bottom: 1em;
}

.mgu-api-select {
    width: 100%;
    padding: 12px;
    margin-bottom: 1em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1.4;
    background-color: #fff;
    cursor: pointer;
}

.mgu-api-select option {
    padding: 12px;
    font-size: 16px;
    line-height: 1.4;
}

.mgu-api-form .form-group {
    margin-bottom: 1.5em;
}

.mgu-api-form label {
    display: block;
    margin-bottom: 0.5em;
    color: #333;
    font-size: 1.1em;
}

.mgu-api-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.mgu-api-button {
    background: #0073aa;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

.mgu-api-button:hover {
    background: #005177;
}

.mgu-api-step-result {
    margin-top: 1em;
    padding: 15px;
    border-radius: 4px;
    font-size: 16px;
}

.mgu-api-step-result.success {
    background: #dff0d8;
    color: #3c763d;
}

.mgu-api-step-result.error {
    background: #f2dede;
    color: #a94442;
}

.mgu-api-quote-details {
    margin: 1em 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 16px;
}

.mgu-api-quote-actions {
    margin: 1em 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mgu-api-button-secondary {
    background: #6c757d;
}

.mgu-api-button-secondary:hover {
    background: #545b62;
}

.mgu-api-description {
    margin-bottom: 2em;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    color: #333;
}

.mgu-api-form-group {
    margin-bottom: 1.5em;
}

/* Two-column row for purchase date/price on desktop */
.mgu-form-row {
    display: block;
}
@media (min-width: 900px) {
    .mgu-form-row {
        display: flex;
        gap: 20px;
    }
    .mgu-form-row .mgu-form-col {
        flex: 0 0 45%;
        max-width: 45%;
    }
}

.mgu-api-form-group label {
    display: block;
    margin-bottom: 0.5em;
    color: #333;
    font-weight: 500;
}

.mgu-api-form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.mgu-api-current-basket {
    margin: 1em 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.mgu-api-basket-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.mgu-api-basket-item:last-child {
    border-bottom: none;
}

.mgu-api-remove-item {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.mgu-api-remove-item:hover {
    background: #c82333;
}

.mgu-api-help-text {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.mgu-period-help {
    margin-top: 8px;
}

.mgu-api-radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.mgu-api-radio-option {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mgu-api-radio-option:hover {
    background-color: #f5f5f5;
}

.mgu-api-radio-option input[type="radio"] {
    margin-right: 10px;
}

.mgu-api-radio-option.selected {
    background-color: #e3f2fd;
    border-color: #2196f3;
}

.mgu-api-button:disabled,
.mgu-api-button.disabled {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.mgu-api-button.enabled {
    background-color: #007cba !important;
    color: white !important;
    cursor: pointer !important;
    opacity: 1;
}

.mgu-api-button.enabled:hover {
    background-color: #005a87 !important;
} 

/* Modern UI: Section cards and active highlighting */
.mgu-api-step {
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.mgu-api-step.is-active {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.12), 0 2px 8px rgba(0,0,0,0.05);
}

.mgu-api-step h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* Option boxes (dynamic choices) */
.mgu-option-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 14px;
    border: 2px solid #e6e6e6;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.mgu-option-box:hover {
    border-color: #bcd8e8;
    background: #f7fbfe;
}

.mgu-option-box input[type="radio"] {
    transform: scale(1.1);
}

.mgu-option-box.selected,
.mgu-option-box input[type="radio"]:checked + label,
.mgu-option-box input[type="radio"]:checked {
    border-color: #0073aa;
    background: #e7f3ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* Option box content */
.mgu-option-amount { font-weight: 700; font-size: 1.05rem; color: #0f2e46; }
.mgu-option-sub { font-size: 0.9rem; color: #444; }

/* Grid layouts for dynamic option groups */
#memory-radio-buttons,
#premium-period-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 640px) {
    #memory-radio-buttons,
    #premium-period-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (min-width: 1024px) {
    #memory-radio-buttons,
    #premium-period-buttons {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Buttons: consistent appearance */
.mgu-api-button {
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 600;
}

.mgu-api-button-secondary {
    background: #6c757d;
    color: #fff;
}

.mgu-api-button-secondary:hover {
    background: #5a6268;
}

/* Summary and quote panels */
.mgu-api-quote-details,
#total-premium-display {
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

#total-premium-display h4,
.mgu-api-quote-details h4 {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
}

#total-premium-display .final-price,
.mgu-api-quote-details .final-price {
    font-size: 1.25rem;
    color: #0073aa;
    font-weight: 700;
}

/* Checkbox/toggle: larger and brand accent, keep native for a11y */
input[type="checkbox"]#policy-loss-cover {
    accent-color: #0073aa;
    transform: scale(1.15);
}

/* Marketing toggle styled like option boxes */
.mgu-marketing-toggle input[type="checkbox"] { position: absolute; opacity: 0; }
.mgu-marketing-toggle label { cursor: pointer; }
.mgu-marketing-toggle.selected { border-color: #0073aa; background: #e7f3ff; }

/* Loss cover toggle styled like option boxes */
.mgu-loss-toggle input[type="checkbox"] { position: absolute; opacity: 0; }
.mgu-loss-toggle label { cursor: pointer; }
.mgu-loss-toggle.selected { border-color: #0073aa; background: #e7f3ff; }

/* Make loss toggle a square like other options */
.mgu-loss-row { gap: 12px; }
.mgu-loss-toggle {
    min-height: 88px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.mgu-loss-toggle label { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.mgu-loss-line { font-weight: 700; }
.mgu-loss-text { font-size: 0.95rem; }
.mgu-loss-toggle .mgu-tick {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #0073aa;
    border-radius: 4px;
    background: #ffffff;
}
.mgu-loss-toggle.selected .mgu-tick {
    background: #0073aa;
    color: #ffffff;
}
.mgu-loss-toggle.selected .mgu-tick::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    font-size: 14px;
}

/* Form labels and help text */
.mgu-api-form-group label {
    font-weight: 600;
}

.mgu-api-help-text {
    color: #5f6b76;
}

/* Responsive spacing */
@media (max-width: 640px) {
    .mgu-api-insurance-flow {
        padding: 16px;
    }
    .mgu-api-button {
        width: 100%;
    }
}

/* Desktop: place Manufacturer and Model steps side by side */
@media (min-width: 900px) {
    #step-manufacturer,
    #step-model {
        display: block;
        float: left;
        width: 47%;
        box-sizing: border-box;
    }
    #step-manufacturer { margin-right: 6%; }
    #step-model { margin-right: 0; }
    #step-device { clear: both; }
}

/* Promo box can be hidden by theme via CSS */
.mgu-promo-box {}

/* Visually hidden utility (kept in DOM for a11y/JS) */
.mgu-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Gadget icon grid */
.mgu-gadget-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 1em;
}

@media (max-width: 640px) {
    .mgu-gadget-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.mgu-gadget-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 88px;
    padding: 12px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #f7f9fb;
    color: #222;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}

.mgu-gadget-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.mgu-gadget-option:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.35);
}

.mgu-gadget-option[aria-checked="true"],
.mgu-gadget-option.selected {
    border-color: #0073aa;
    background: #e7f3ff;
}

.mgu-gadget-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.mgu-gadget-label {
    font-size: 14px;
}

/* Color variants per gadget type (can be themed) */
.mgu-gadget--MobilePhone { --mgu-accent: #0073aa; }
.mgu-gadget--Laptop { --mgu-accent: #6f42c1; }
.mgu-gadget--Tablet { --mgu-accent: #d63384; }
.mgu-gadget--VRHeadset { --mgu-accent: #20c997; }
.mgu-gadget--Watch { --mgu-accent: #fd7e14; }
.mgu-gadget--GamesConsole { --mgu-accent: #198754; }

.mgu-gadget-option {
    border-color: color-mix(in srgb, var(--mgu-accent) 30%, transparent);
}

.mgu-gadget-option[aria-checked="true"],
.mgu-gadget-option.selected {
    border-color: var(--mgu-accent);
    background: color-mix(in srgb, var(--mgu-accent) 12%, #ffffff);
}

/* Delete gadget button - responsive positioning */
.mgu-delete-gadget-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.mgu-delete-gadget-btn:hover {
    background: #c82333;
}

@media (max-width: 640px) {
    .mgu-delete-gadget-btn {
        position: static;
        width: 100%;
        margin-top: 10px;
    }
}

/* Quote summary and breakdown styling */
.mgu-quote-summary-container {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin: 15px 0;
}

.mgu-quote-summary-title {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
}

.mgu-gadget-items-wrapper {
    margin: 10px 0;
}

.mgu-gadget-item-detail {
    border: 1px solid #ddd;
    padding: 10px;
    margin: 5px 0;
    border-radius: 3px;
    background: white;
    position: relative;
}

.mgu-gadget-item-detail h5 {
    margin: 0 0 5px 0;
}

.mgu-gadget-item-detail p {
    margin: 2px 0;
}

.mgu-quote-breakdown {
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.mgu-quote-breakdown p {
    margin: 5px 0;
}

.mgu-quote-breakdown-bold {
    font-weight: bold;
}

.mgu-quote-discount-info {
    color: #666;
    font-style: italic;
}

.mgu-quote-discount-positive {
    color: #28a745;
    font-weight: bold;
}

.mgu-discount-amount {
    color: #28a745;
    font-weight: bold;
}

.mgu-quote-final-premium {
    margin: 10px 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #007cba;
}

.mgu-help-text-small {
    font-size: 0.9em;
    color: #666;
}

/* Documents notice styling */
.mgu-documents-notice {
    margin: 20px 0;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.mgu-documents-notice p {
    margin: 0;
    color: #856404;
}

.mgu-documents-notice a {
    color: #0073aa;
    text-decoration: underline;
}

.mgu-documents-notice a:hover {
    color: #005a87;
    text-decoration: none;
}