/**
 * WordPress Address Finder - Frontend Styles
 */

/* Main container */
#waf-address-finder {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
}

#waf-address-finder h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* Postcode search section */
.waf-postcode-search {
    margin-bottom: 15px;
}

.waf-postcode-search label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.waf-postcode-search input {
    width: 200px !important;
    padding: 8px 12px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    text-transform: uppercase;
    margin-right: 10px;
    box-sizing: border-box !important;
}

.waf-postcode-search input:focus {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1) !important;
    outline: none !important;
}

.waf-postcode-search input.waf-invalid {
    border-color: #dc3232 !important;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.8) !important;
}

#waf-search-btn {
    background: #0073aa !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: background-color 0.2s ease !important;
}

#waf-search-btn:hover {
    background: #005a87 !important;
}

#waf-search-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
}

/* Address results section */
#waf-address-results {
    margin-bottom: 15px;
}

#waf-address-results label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

#waf-address-select {
    width: 100% !important;
    padding: 8px 12px !important;
    border: 1px solid #ccc !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    background: white !important;
}

#waf-address-select:focus {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1) !important;
    outline: none !important;
}

/* Manual entry toggle */
#waf-manual-entry {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
    margin-top: 15px;
}

#waf-manual-entry p {
    margin: 0;
}

#waf-manual-link {
    color: #0073aa;
    text-decoration: none;
    font-size: 13px;
}

#waf-manual-link:hover {
    text-decoration: underline;
}

/* Manual mode styles */
#waf-address-finder.manual-mode .waf-postcode-search,
#waf-address-finder.manual-mode #waf-address-results {
    opacity: 0.5;
    pointer-events: none;
}

/* Message styles */
.waf-message {
    padding: 8px 12px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    align-items: center;
    animation: waf-fadeIn 0.3s ease;
}

.waf-message .dashicons {
    margin-right: 8px;
    font-size: 16px;
}

.waf-error {
    background: #ffeaea;
    border: 1px solid #dc3232;
    color: #721c24;
}

.waf-error .dashicons {
    color: #dc3232;
}

.waf-success {
    background: #eafaea;
    border: 1px solid #46b450;
    color: #155724;
}

.waf-success .dashicons {
    color: #46b450;
}

/* Loading spinner */
#waf-search-btn.loading:after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: waf-spin 1s linear infinite;
}

/* Animations */
@keyframes waf-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive design */
@media (max-width: 768px) {
    .waf-postcode-search input {
        width: 100% !important;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    #waf-search-btn {
        width: 100% !important;
    }
}

/* WooCommerce specific styles */
.woocommerce #waf-address-finder {
    clear: both;
}

.woocommerce-checkout #waf-address-finder {
    margin: 0 0 20px 0;
}

/* Override WooCommerce field styles when needed */
.woocommerce .waf-postcode-search input,
.woocommerce #waf-address-select {
    height: auto !important;
    line-height: normal !important;
}

/* Admin styles */
.waf-admin-notice {
    background: white;
    border-left: 4px solid #0073aa;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    margin: 5px 15px 2px;
    padding: 1px 12px;
}

.waf-admin-notice p {
    margin: 0.5em 0;
    padding: 2px;
    font-size: 13px;
    line-height: 1.5;
}

/* Settings page styles */
.waf-settings-page .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
    line-height: 1.3;
}

.waf-settings-page .form-table td {
    padding: 15px 10px;
}

.waf-settings-page .description {
    font-style: italic;
    color: #666;
}

/* Accessibility improvements */
.waf-postcode-search input:focus,
#waf-address-select:focus,
#waf-search-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #waf-address-finder {
        border-color: #000;
    }
    
    .waf-postcode-search input,
    #waf-address-select {
        border-color: #000;
    }
    
    #waf-search-btn {
        background: #000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .waf-message,
    #waf-search-btn.loading:after {
        animation: none;
    }
}
