/**
 * Checkout styles for ATW Address Validation
 */

/* Autocomplete dropdown */
.atw-autocomplete-container {
    position: relative;
}

.atw-autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.atw-autocomplete-suggestions.active {
    display: block;
}

.atw-autocomplete-suggestion {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

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

.atw-autocomplete-suggestion:hover,
.atw-autocomplete-suggestion.highlighted {
    background-color: #f8f9fa;
}

.atw-autocomplete-suggestion.selected {
    background-color: #007cba;
    color: #fff;
}

.atw-autocomplete-suggestion-text {
    font-weight: 500;
    margin-bottom: 2px;
}

.atw-autocomplete-suggestion-details {
    font-size: 12px;
    color: #666;
}

.atw-autocomplete-suggestion.selected .atw-autocomplete-suggestion-details {
    color: #ccc;
}

/* Address validation feedback */
.atw-validation-feedback {
    margin-top: 10px;
    padding: 12px;
    border-radius: 4px;
    display: none;
}

.atw-validation-feedback.show {
    display: block;
}

.atw-validation-feedback.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.atw-validation-feedback.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.atw-validation-feedback.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.atw-validation-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
}

.atw-validation-icon.success::before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
}

.atw-validation-icon.warning::before {
    content: "⚠";
    color: #ffc107;
}

.atw-validation-icon.error::before {
    content: "✗";
    color: #dc3545;
    font-weight: bold;
}

/* Address suggestion modal */
.atw-address-suggestion-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.atw-address-suggestion-modal.show {
    display: flex;
}

.atw-address-suggestion-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.atw-address-suggestion-header {
    margin-bottom: 20px;
}

.atw-address-suggestion-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.atw-address-suggestion-description {
    color: #666;
    font-size: 14px;
}

.atw-address-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.atw-address-block {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 16px;
}

.atw-address-block.suggested {
    border-color: #007cba;
    background-color: #f8f9fa;
}

.atw-address-block-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.atw-address-block.suggested .atw-address-block-title {
    color: #007cba;
}

.atw-address-line {
    margin-bottom: 4px;
    font-size: 14px;
}

.atw-address-suggestion-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.atw-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.atw-btn-primary {
    background-color: #007cba;
    color: #fff;
}

.atw-btn-primary:hover {
    background-color: #005a87;
    color: #fff;
}

.atw-btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.atw-btn-secondary:hover {
    background-color: #545b62;
    color: #fff;
}

/* Loading states */
.atw-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.atw-loading-overlay.show {
    display: flex;
}

.atw-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: atw-spin 1s linear infinite;
}

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

/* Field highlighting */
.atw-field-validating {
    border-color: #007cba !important;
    box-shadow: 0 0 0 1px #007cba !important;
}

.atw-field-valid {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 1px #28a745 !important;
}

.atw-field-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px #dc3545 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .atw-address-comparison {
        grid-template-columns: 1fr;
    }
    
    .atw-address-suggestion-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .atw-address-suggestion-actions {
        flex-direction: column;
    }
    
    .atw-btn {
        width: 100%;
        text-align: center;
    }
}

/* Integration with WooCommerce styles */
.woocommerce .atw-autocomplete-container {
    position: relative;
}

.woocommerce .atw-validation-feedback {
    font-size: 14px;
}

/* Hide autocomplete on mobile if needed */
@media (max-width: 480px) {
    .atw-autocomplete-suggestions {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 8px 8px 0 0;
        max-height: 50vh;
    }
}
