/**
 * WC Delivery Zone Selector - Frontend Styles
 */

/* CSS Variables (set via PHP) */
:root {
    --wcdzs-primary: #1a7f8e;
    --wcdzs-secondary: #ffffff;
    --wcdzs-button: #5bb9c7;
    --wcdzs-text: #333333;
    --wcdzs-overlay: rgba(0,0,0,0.5);
    --wcdzs-radius: 8px;
    --wcdzs-width: 450px;
}

/* Overlay */
.wcdzs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--wcdzs-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcdzs-overlay.wcdzs-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Animations */
.wcdzs-animation-fade .wcdzs-popup {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wcdzs-animation-fade.wcdzs-hidden .wcdzs-popup {
    opacity: 0;
    transform: translateY(-20px);
}

.wcdzs-animation-slide .wcdzs-popup {
    transition: transform 0.3s ease;
}

.wcdzs-animation-slide.wcdzs-hidden .wcdzs-popup {
    transform: translateY(-100%);
}

.wcdzs-animation-scale .wcdzs-popup {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.wcdzs-animation-scale.wcdzs-hidden .wcdzs-popup {
    transform: scale(0.8);
    opacity: 0;
}

/* Popup */
.wcdzs-popup {
    background: var(--wcdzs-secondary);
    border-radius: var(--wcdzs-radius);
    width: 100%;
    max-width: var(--wcdzs-width);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.wcdzs-popup-content {
    padding: 40px 30px;
    text-align: center;
}

/* Close Button */
.wcdzs-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #999;
    transition: color 0.2s ease;
    z-index: 1;
}

.wcdzs-close:hover {
    color: #333;
}

.wcdzs-close svg {
    display: block;
}

/* Title */
.wcdzs-title {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
    color: var(--wcdzs-text);
}

/* Order Type Buttons */
.wcdzs-order-types {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.wcdzs-order-type-btn {
    background: transparent;
    border: 2px solid #ddd;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.wcdzs-order-type-btn:hover {
    border-color: var(--wcdzs-primary);
    color: var(--wcdzs-primary);
}

.wcdzs-order-type-btn.active {
    background: var(--wcdzs-primary);
    border-color: var(--wcdzs-primary);
    color: #fff;
}

/* Delivery Badge */
.wcdzs-delivery-badge {
    margin-bottom: 20px;
}

.wcdzs-delivery-badge span {
    display: inline-block;
    background: var(--wcdzs-primary);
    color: #fff;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Subtitle */
.wcdzs-subtitle {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--wcdzs-text);
    opacity: 0.8;
}

/* Geolocation Button */
.wcdzs-geolocation-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--wcdzs-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.wcdzs-geolocation-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.wcdzs-geolocation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wcdzs-geolocation-btn svg {
    flex-shrink: 0;
}

.wcdzs-geolocation-btn.loading svg {
    animation: wcdzs-spin 1s linear infinite;
}

@keyframes wcdzs-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dropdown */
.wcdzs-dropdown-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.wcdzs-select {
    width: 100%;
    padding: 14px 40px 14px 16px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: var(--wcdzs-radius);
    background: #fff;
    color: var(--wcdzs-text);
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.wcdzs-select:hover,
.wcdzs-select:focus {
    border-color: var(--wcdzs-primary);
    outline: none;
}

.wcdzs-select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #999;
}

/* Zone Info */
.wcdzs-zone-info {
    background: #f8f9fa;
    border-radius: var(--wcdzs-radius);
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.wcdzs-zone-info p {
    margin: 0;
    font-size: 14px;
    color: var(--wcdzs-text);
}

.wcdzs-zone-info p + p {
    margin-top: 5px;
}

/* Submit Button */
.wcdzs-submit-btn {
    width: 100%;
    background: var(--wcdzs-button);
    color: #fff;
    border: none;
    padding: 16px 24px;
    border-radius: var(--wcdzs-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcdzs-submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.wcdzs-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Location Badge (Header) */
.wcdzs-badge {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 99999;
}

.wcdzs-badge-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--wcdzs-secondary);
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 14px;
    color: var(--wcdzs-text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.wcdzs-badge-btn:hover {
    border-color: var(--wcdzs-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wcdzs-badge.has-location .wcdzs-badge-btn {
    background: var(--wcdzs-primary);
    color: #fff;
    border-color: var(--wcdzs-primary);
}

.wcdzs-badge.has-location .wcdzs-badge-btn svg {
    stroke: #fff;
}

/* Inline Dropdown */
.wcdzs-inline-dropdown {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.wcdzs-inline-dropdown .wcdzs-dropdown-wrapper {
    flex: 1;
    margin-bottom: 0;
}

.wcdzs-inline-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: var(--wcdzs-radius);
    background: #fff;
    appearance: none;
    cursor: pointer;
}

.wcdzs-inline-submit {
    background: var(--wcdzs-button);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--wcdzs-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.wcdzs-inline-submit:hover {
    opacity: 0.9;
}

/* Trigger Button */
.wcdzs-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--wcdzs-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcdzs-trigger-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.wcdzs-trigger-btn svg {
    flex-shrink: 0;
}

/* Location Links */
.wcdzs-location-link {
    color: var(--wcdzs-primary);
    text-decoration: none;
    cursor: pointer;
}

.wcdzs-location-link:hover {
    text-decoration: underline;
}

/* Zone Details */
.wcdzs-zone-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.wcdzs-zone-name {
    font-weight: 600;
}

.wcdzs-zone-fee {
    color: #666;
    font-size: 14px;
}

.wcdzs-zone-fee.wcdzs-free {
    color: #28a745;
}

.wcdzs-zone-min {
    color: #666;
    font-size: 14px;
}

/* Cart Zone Selector */
.wcdzs-cart-zone-selector {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: var(--wcdzs-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
}

.wcdzs-cart-zone-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.wcdzs-cart-zone-info strong {
    color: var(--wcdzs-text);
}

.wcdzs-cart-zone-info .wcdzs-zone-name {
    font-weight: 600;
}

.wcdzs-cart-zone-info .wcdzs-zone-fee {
    color: #666;
}

.wcdzs-cart-zone-info .wcdzs-change-zone {
    margin-left: auto;
    color: var(--wcdzs-primary);
    text-decoration: none;
}

.wcdzs-cart-zone-info .wcdzs-change-zone:hover {
    text-decoration: underline;
}

/* Checkout Notice */
.wcdzs-checkout-notice {
    cursor: pointer;
}

.wcdzs-checkout-notice .wcdzs-select-zone-link {
    color: var(--wcdzs-primary);
    text-decoration: none;
}

.wcdzs-checkout-zone .wcdzs-change-zone {
    color: var(--wcdzs-primary);
    text-decoration: none;
    margin-left: 10px;
}

/* Admin Order Info */
.wcdzs-admin-order-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.wcdzs-admin-order-info h3 {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
}

.wcdzs-admin-order-info p {
    margin: 5px 0;
}

/* Order Zone Section */
.wcdzs-order-zone {
    margin-top: 20px;
}

.wcdzs-order-zone h2 {
    font-size: 18px;
}

/* Elementor Widget Styles */
.wcdzs-el-wrapper {
    display: inline-block;
}

.wcdzs-el-clickable {
    cursor: pointer;
}

.wcdzs-el-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f5f5f5;
    border-radius: 25px;
    transition: all 0.2s ease;
}

.wcdzs-el-badge:hover {
    background: #eee;
}

.wcdzs-el-badge.has-location {
    background: var(--wcdzs-primary);
    color: #fff;
}

.wcdzs-el-badge.has-location svg {
    stroke: #fff;
}

.wcdzs-el-icon {
    display: flex;
    align-items: center;
}

.wcdzs-el-text-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wcdzs-el-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcdzs-el-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Toast Notifications */
.wcdzs-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.wcdzs-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.wcdzs-toast.success {
    background: #28a745;
}

.wcdzs-toast.error {
    background: #dc3545;
}

/* Responsive */
@media (max-width: 600px) {
    .wcdzs-popup-content {
        padding: 30px 20px;
    }
    
    .wcdzs-title {
        font-size: 18px;
    }
    
    .wcdzs-badge {
        top: 10px;
        left: 10px;
    }
    
    .wcdzs-badge-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .wcdzs-badge-btn .wcdzs-badge-text {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .wcdzs-inline-dropdown {
        flex-direction: column;
    }
    
    .wcdzs-cart-zone-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wcdzs-cart-zone-info .wcdzs-change-zone {
        margin-left: 0;
        margin-top: 5px;
    }
}
