/* Distance Pricing Calculator Styles - Enhanced Version 1.1.0 */

/* Popup Overlay */
.dpc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999999 !important;
    display: none;
    backdrop-filter: blur(5px);
    animation: dpcFadeIn 0.3s ease-out;
}

@keyframes dpcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Main Popup */
.dpc-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    animation: dpcSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 999999999 !important;
}

@keyframes dpcSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Popup Header */
.dpc-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 20px 20px 0 0;
    position: relative;
    text-align: center;
}

.dpc-popup-header h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dpc-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.dpc-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Enhanced Progress Bar */
.dpc-progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 25px 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.dpc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 4px;
    position: relative;
}

.dpc-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: dpcShine 2s infinite;
}

@keyframes dpcShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.dpc-progress-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 8px;
    font-weight: 500;
}

/* Form Styles */
.dpc-form {
    padding: 35px;
}

.dpc-form-group {
    margin-bottom: 25px;
    position: relative;
}

.dpc-form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
    transition: color 0.3s ease;
}

.dpc-form-group input,
.dpc-form-group select {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dpc-form-group input:focus,
.dpc-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.dpc-form-group input.dpc-error,
.dpc-form-group select.dpc-error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
}

.dpc-form-group input.dpc-success,
.dpc-form-group select.dpc-success {
    border-color: #27ae60;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

.dpc-form-group input.dpc-valid-address {
    border-color: #27ae60;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="%2327ae60"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 18px;
    padding-right: 50px;
}

.dpc-form-group input::placeholder {
    color: #999;
    font-style: italic;
}

/* Address Input Wrapper */
.dpc-address-input-wrapper {
    position: relative;
}

.dpc-address-validation {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 500;
    z-index: 10;
}

.dpc-validation-loading {
    color: #f39c12;
}

.dpc-validation-success {
    color: #27ae60;
}

.dpc-validation-error {
    color: #e74c3c;
}

/* Google Places Autocomplete Styling */
.pac-container {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: none;
    font-family: inherit;
    z-index: 999999999 !important;
    margin-top: 5px;
}

.pac-item {
    padding: 12px 18px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.pac-item:hover {
    background-color: #f8f9fa;
}

.pac-item-selected {
    background-color: #e3f2fd;
}

/* Address field specific styling */
#dpc-pickup, #dpc-delivery {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="%23667eea" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>');
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 18px;
    padding-right: 55px;
}

/* Enhanced Submit Button */
.dpc-submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.dpc-submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.dpc-submit-btn:active {
    transform: translateY(-1px);
}

.dpc-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.dpc-btn-text,
.dpc-btn-loading {
    display: inline-block;
    vertical-align: middle;
}

.dpc-btn-loading {
    display: none;
}

.dpc-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: dpcSpin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes dpcSpin {
    to { transform: rotate(360deg); }
}

/* Enhanced Result Section */
.dpc-result {
    padding: 35px;
    text-align: center;
}

.dpc-result-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.dpc-result-header h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
    font-weight: 700;
}

.dpc-quote-id {
    font-size: 14px;
    color: #666;
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    font-family: monospace;
}

.dpc-quote-details {
    margin: 25px 0;
}

.dpc-quote-item {
    margin: 15px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 18px;
    color: #333;
    border-left: 4px solid #667eea;
    text-align: left;
}

#dpc-price {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-weight: 700;
    font-size: 22px;
    border-left-color: #28a745;
    text-align: center;
}

/* Enhanced Action Buttons */
.dpc-result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 25px;
}

.dpc-new-quote-btn,
.dpc-print-quote-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dpc-new-quote-btn:hover,
.dpc-print-quote-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

.dpc-btn-icon {
    font-size: 16px;
}

/* Enhanced Trigger Button */
.dpc-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 28px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
    z-index: 999999998 !important;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.dpc-trigger:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 16px 45px rgba(102, 126, 234, 0.5);
}

.dpc-trigger:active {
    transform: translateY(-2px) scale(1.02);
}

.dpc-trigger-icon {
    font-size: 20px;
}

.dpc-trigger-text {
    white-space: nowrap;
}

/* Shortcode trigger variations */
.dpc-trigger-bottom-left {
    bottom: 30px;
    left: 30px;
    right: auto;
}

.dpc-trigger-top-right {
    top: 30px;
    bottom: auto;
    right: 30px;
}

.dpc-trigger-top-left {
    top: 30px;
    bottom: auto;
    left: 30px;
    right: auto;
}

/* Enhanced Confirmation Section */
.dpc-confirmation-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
    text-align: center;
    border: 2px solid #e1e5e9;
}

.dpc-confirmation-section p {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.dpc-confirmation-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.dpc-confirm-btn,
.dpc-decline-btn {
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
    justify-content: center;
}

.dpc-confirm-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.dpc-confirm-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(40, 167, 69, 0.4);
}

.dpc-decline-btn {
    background: #6c757d;
    color: white;
}

.dpc-decline-btn:hover {
    background: #5a6268;
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(108, 117, 125, 0.4);
}

/* Enhanced Success Message */
.dpc-success-message {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
}

/* Enhanced Notification System */
.dpc-notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 18px 25px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 999999999;
    transform: translateX(400px);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-width: 350px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.dpc-notification.dpc-show {
    transform: translateX(0);
}

.dpc-notification.dpc-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.dpc-notification.dpc-error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.dpc-notification.dpc-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.dpc-notification.dpc-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

/* Enhanced Error States */
.dpc-error-message {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 8px;
    display: none;
    font-weight: 500;
    padding: 8px 12px;
    background: #fdf2f2;
    border-radius: 6px;
    border-left: 3px solid #e74c3c;
}

.dpc-form-group input.dpc-error + .dpc-error-message {
    display: block;
}

/* Field Hints */
.dpc-field-hint {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

/* Loading States */
.dpc-loading {
    position: relative;
    pointer-events: none;
}

.dpc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: dpc-spin 1s linear infinite;
    z-index: 10;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dpc-popup {
        width: 95%;
        margin: 20px;
        border-radius: 15px;
    }
    
    .dpc-form {
        padding: 25px;
    }
    
    .dpc-popup-header {
        padding: 20px;
        border-radius: 15px 15px 0 0;
    }
    
    .dpc-popup-header h3 {
        font-size: 22px;
    }
    
    .dpc-trigger {
        bottom: 20px;
        right: 20px;
        padding: 15px 22px;
        font-size: 14px;
    }
    
    .dpc-confirmation-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .dpc-confirm-btn,
    .dpc-decline-btn {
        width: 100%;
        min-width: auto;
    }
    
    .dpc-result-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .dpc-new-quote-btn,
    .dpc-print-quote-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .dpc-popup {
        width: 98%;
        margin: 10px;
        border-radius: 12px;
    }
    
    .dpc-form {
        padding: 20px;
    }
    
    .dpc-form-group input,
    .dpc-form-group select {
        padding: 14px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 10px;
    }
    
    .dpc-trigger {
        bottom: 15px;
        right: 15px;
        padding: 12px 18px;
        font-size: 13px;
        border-radius: 40px;
    }
    
    .dpc-popup-header h3 {
        font-size: 20px;
    }
    
    .dpc-submit-btn {
        padding: 16px;
        font-size: 16px;
        border-radius: 10px;
    }
}

/* Print Styles */
@media print {
    .dpc-popup-overlay {
        position: static;
        background: none;
    }
    
    .dpc-popup {
        position: static;
        transform: none;
        box-shadow: none;
        border: 2px solid #000;
        max-height: none;
        overflow: visible;
    }
    
    .dpc-popup-header {
        background: #f0f0f0 !important;
        color: #000 !important;
        border-radius: 0;
    }
    
    .dpc-trigger,
    .dpc-close-btn,
    .dpc-confirmation-section,
    .dpc-result-actions {
        display: none !important;
    }
}

/* Accessibility Improvements */
.dpc-popup:focus {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

.dpc-form-group input:focus + label {
    color: #667eea;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .dpc-popup {
        border: 3px solid #000;
    }
    
    .dpc-form-group input,
    .dpc-form-group select {
        border-width: 3px;
    }
    
    .dpc-submit-btn {
        border: 3px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .dpc-popup,
    .dpc-submit-btn,
    .dpc-trigger,
    .dpc-notification {
        animation: none;
        transition: none;
    }
    
    .dpc-submit-btn:hover,
    .dpc-trigger:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dpc-popup {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .dpc-form-group label {
        color: #e2e8f0;
    }
    
    .dpc-form-group input,
    .dpc-form-group select {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .dpc-form-group input::placeholder {
        color: #a0aec0;
    }
    
    .dpc-quote-item {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .dpc-confirmation-section {
        background: linear-gradient(135deg, #4a5568 0%, #718096 100%);
        border-color: #718096;
    }
}

/* Force popup to be above everything */
.dpc-popup-overlay,
.dpc-popup,
.dpc-trigger {
    position: fixed !important;
    z-index: 999999999 !important;
}

.dpc-popup-overlay {
    z-index: 999999999 !important;
}

.dpc-popup {
    z-index: 999999999 !important;
}

.dpc-trigger {
    z-index: 999999998 !important;
}

/* Google Places Autocomplete */
.pac-container {
    z-index: 999999999 !important;
}

/* Admin Page Styles */
.dpc-admin-info {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    margin-top: 35px;
    border-left: 5px solid #667eea;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dpc-admin-info h3 {
    margin-top: 0;
    color: #333;
    font-size: 20px;
    font-weight: 700;
}

.dpc-admin-info ol {
    margin-left: 25px;
}

.dpc-admin-info li {
    margin-bottom: 12px;
    line-height: 1.7;
}

.dpc-stats {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dpc-stats h3 {
    margin-top: 0;
    color: #667eea;
    font-size: 20px;
    font-weight: 700;
}

.dpc-stats p {
    margin: 12px 0;
    font-size: 16px;
    line-height: 1.6;
}

.dpc-export {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 12px;
    margin-top: 25px;
    border-left: 5px solid #28a745;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dpc-export h3 {
    margin-top: 0;
    color: #28a745;
    font-size: 20px;
    font-weight: 700;
}

/* Admin Status Check Styling */
.dpc-admin-info .button {
    margin-top: 12px;
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.dpc-admin-info .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dpc-admin-info p {
    margin: 10px 0;
    line-height: 1.6;
}

.dpc-admin-info strong {
    color: #333;
    font-weight: 700;
}

/* Enhanced Loading States */
.dpc-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}

/* Custom CSS Support */
.dpc-custom-css {
    /* This will be populated by admin settings */
}
