/**
 * Shipco Mini Calculator Styles
 */

/* Main Calculator Container */
.shipco-mini-calculator {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.shipco-mini-header {
    margin-bottom: 24px;
}

.shipco-mini-header h2 {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px;
}

.shipco-mini-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.shipco-mini-header a {
    color: #0066cc;
    text-decoration: none;
}

/* Form */
.shipco-mini-form {
    display: block;
}

.shipco-form-group {
    margin-bottom: 0;
}

.shipco-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.shipco-form-group input[type="text"],
.shipco-form-group input[type="email"],
.shipco-form-group input[type="tel"],
.shipco-form-group select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    background: #fff;
    margin: 0;
}

.shipco-form-group input::placeholder {
    color: #999;
}

.shipco-form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.shipco-form-group select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Radio Buttons */
.shipco-radio-group {
    display: flex;
    gap: 24px;
}

.shipco-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.shipco-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0 8px 0 0;
    accent-color: #0066cc;
}

.shipco-radio span {
    font-size: 14px;
    color: #333;
}

/* Navigation Buttons */
.shipco-next-btn,
.shipco-submit-btn {
    width: 100%;
    height: 48px;
    background: #e86f56;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s;
}

.shipco-next-btn:hover,
.shipco-submit-btn:hover {
    background: #d65d44;
}

/* Button states */
.shipco-next-btn:disabled,
.shipco-submit-btn:disabled {
    background-color: #ccc !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.shipco-next-btn:disabled:hover,
.shipco-submit-btn:disabled:hover {
    background-color: #ccc !important;
    transform: none !important;
}

/* Progress Dots */
.shipco-mini-progress {
    margin-top: 32px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding: 0 12px;
}

.shipco-mini-progress:before {
    content: '';
    position: absolute;
    top: 12px;
    left: 36px;
    right: 36px;
    height: 1px;
    background: #ddd;
    z-index: 0;
}

.shipco-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.shipco-step-number,
.shipco-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
}

.shipco-step.active .shipco-step-number {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.shipco-step.completed .shipco-step-icon {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.shipco-step span {
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* Legal Information */
.shipco-mini-legal {
    margin-top: 16px;
    margin-bottom: 16px;
}

.shipco-mini-legal p {
    font-size: 11px;
    line-height: 1.4;
    color: #666;
    margin: 0;
}

.shipco-mini-legal a {
    color: #0066cc;
    text-decoration: none;
}

/* Error States */
.shipco-error {
    border-color: #f44336 !important;
}

.error-message {
    color: #f44336;
    font-size: 12px;
    margin-top: 5px;
}

/* Loading State */
.shipco-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.shipco-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Theme Variations */
.shipco-theme-dark {
    background-color: #333;
    color: #fff;
}

.shipco-theme-dark .shipco-mini-header {
    background-color: #444;
}

.shipco-theme-dark .shipco-mini-header h3 {
    color: #fff;
}

.shipco-theme-dark .shipco-form-group label {
    color: #fff;
}

.shipco-theme-dark .shipco-form-group input[type="text"],
.shipco-theme-dark .shipco-form-group select {
    background-color: #444;
    border-color: #555;
    color: #fff;
}

.shipco-theme-dark .shipco-form-group input::placeholder,
.shipco-theme-dark .shipco-form-group select::placeholder {
    color: #888;
}

.shipco-theme-dark .shipco-mini-progress {
    border-top-color: #444;
}

.shipco-theme-dark .shipco-dot {
    background-color: #555;
}

/* Responsive Styles */
@media (max-width: 480px) {
    .shipco-mini-calculator {
        margin: 10px;
        border-radius: 8px;
    }

    .shipco-mini-header {
        padding: 15px;
    }

    .shipco-mini-header h3 {
        font-size: 20px;
    }

    .shipco-mini-form {
        padding: 15px;
    }

    .shipco-form-group {
        margin-bottom: 15px;
    }

    .shipco-mini-nav {
        margin-top: 20px;
    }

    .shipco-mini-prev,
    .shipco-mini-next,
    .shipco-mini-submit {
        padding: 12px 15px;
        font-size: 14px;
    }
}

.shipco-form-group input.error,
.shipco-form-group select.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

.shipco-field-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.shipco-form-group input.error:focus,
.shipco-form-group select.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Add error icon to invalid fields */
.shipco-form-group input.error,
.shipco-form-group select.error {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath stroke-linecap='round' d='M6 3.75v1.5M6 8.25h.01'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Add error message animation */
.shipco-field-error {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Google Maps PlaceAutocompleteElement styling */
gmp-place-autocomplete {
    width: 100% !important;
    height: 44px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    font-size: 14px !important;
    padding: 0 12px !important;
    background-color: #fff !important;
    color: #333 !important;
    transition: border-color 0.3s ease !important;
    appearance: none !important;
    outline: none !important;
}

gmp-place-autocomplete:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3) !important;
    outline: none !important;
}

gmp-place-autocomplete:hover {
    border-color: #bbb !important;
}

.shipco-form-group gmp-place-autocomplete {
    display: block !important;
    margin-bottom: 5px !important;
}

/* Hide the original input when replaced by autocomplete */
.shipco-form-group input[style*="display: none"] {
    display: none !important;
}

/* Google Maps Places Autocomplete Dropdown Styling - FORCE VISIBILITY */
.pac-container {
    border-radius: 4px !important;
    border: 1px solid #ddd !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    margin-top: 1px !important;
    z-index: 99999 !important;
    background: white !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    min-width: 200px !important;
    max-width: 400px !important;
    min-height: 40px !important;
    max-height: 200px !important;
    overflow-y: auto !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    clip: auto !important;
    clip-path: none !important;
}

/* Force all pac-container instances to be visible */
div.pac-container,
.pac-container[style],
.pac-container[style*="display"],
.pac-container[style*="visibility"],
.pac-container[style*="opacity"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 99999 !important;
    position: absolute !important;
    background: white !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    max-height: 200px !important;
    overflow-y: auto !important;
}

.pac-container .pac-item {
    border: none !important;
    padding: 8px 12px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    color: #333 !important;
    background: white !important;
    display: block !important;
    min-height: 30px !important;
    line-height: 1.4 !important;
}

.pac-container .pac-item:hover {
    background-color: #f5f5f5 !important;
}

.pac-container .pac-item-selected {
    background-color: #e3f2fd !important;
}

/* Hide Google Maps branding and attribution */
.pac-logo,
.pac-logo:after,
.hdpi.pac-logo:after {
    display: none !important;
}

.pac-container .pac-item .pac-icon {
    display: none !important;
}

.pac-container .pac-item .pac-item-query {
    font-weight: 500 !important;
    color: #333 !important;
}

.pac-container .pac-item .pac-matched {
    font-weight: 600 !important;
    color: #3498db !important;
}

/* Remove "Powered by Google" text */
.pac-container:after {
    display: none !important;
}

/* Hide Google Maps attribution in suggestions */
gmp-place-autocomplete::part(listbox) {
    border-radius: 4px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1px;
}

gmp-place-autocomplete::part(option) {
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    border: none;
}

gmp-place-autocomplete::part(option):hover {
    background-color: #f5f5f5;
}

gmp-place-autocomplete::part(option)[aria-selected="true"] {
    background-color: #e3f2fd;
}

/* Hide any Google branding in the autocomplete */
gmp-place-autocomplete [data-value*="google"],
gmp-place-autocomplete [data-value*="Google"],
gmp-place-autocomplete [data-value*="maps"] {
    display: none !important;
}

/* Remove Google Maps attribution from dropdown */
.gm-style .gm-style-cc,
.gm-style .gmnoprint,
.gm-bundled-control,
.gmnoprint {
    display: none !important;
}

/* Hide Google Maps link at bottom of autocomplete */
.pac-container .pac-logo,
.pac-container .pac-logo:after,
.pac-container:after {
    display: none !important;
}

/* Hide any "Google Maps" text in suggestions */
.pac-item-query .pac-matched,
.pac-item-query .pac-matched+span {
    background: none !important;
}

/* Remove powered by Google from bottom */
[aria-label*="Google"],
[aria-label*="google"],
[title*="Google"],
[title*="google"] {
    display: none !important;
}

/* Hide Google attributions completely */
.pac-container a[href*="maps.google"],
.pac-container a[href*="google.com/maps"] {
    display: none !important;
}

/* Remove Google branding from specific elements */
gmp-place-autocomplete a,
gmp-place-autocomplete [href*="google"],
gmp-place-autocomplete [href*="maps"] {
    display: none !important;
}

/* Hide the Google Maps button/link that appears in suggestions */
.pac-item .pac-icon-marker,
.pac-item .pac-icon {
    display: none !important;
}

/* Clean up the suggestion text to remove Google branding */
.pac-item-query {
    padding-right: 0 !important;
}

/* Remove Google attribution text */
div[style*="color: rgb(181, 181, 181)"],
div[style*="color: rgb(181,181,181)"],
div[style*="color:#b5b5b5"],
span[style*="color: rgb(181, 181, 181)"] {
    display: none !important;
}

/* Style the autocomplete input to look normal */
gmp-place-autocomplete input {
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    font-family: inherit !important;
    font-size: inherit !important;
    color: inherit !important;
    background: transparent !important;
}

/* Ensure placeholder text is visible */
gmp-place-autocomplete::placeholder,
gmp-place-autocomplete input::placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}