/**
 * Nepal Shipping Zones - Frontend Styles
 */

/* Hide fields when not Nepal */
.nsz-hidden-if-nepal {
    display: none !important;
}

/* Nepal location fields */
.nsz-nepal-only {
    transition: opacity 0.3s ease, height 0.3s ease;
}

/* Province, District, Area field styling */
.nsz-province-field,
.nsz-district-field,
.nsz-area-field {
    margin-bottom: 15px;
}

.nsz-province-field select,
.nsz-district-field select,
.nsz-area-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.nsz-province-field select:focus,
.nsz-district-field select:focus,
.nsz-area-field select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

.nsz-province-field select:disabled,
.nsz-district-field select:disabled,
.nsz-area-field select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Label styling */
.nsz-province-field label,
.nsz-district-field label,
.nsz-area-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.nsz-province-field label .required,
.nsz-district-field label .required,
.nsz-area-field label .required {
    color: #e2401c;
}

/* Loading state */
.nsz-loading {
    position: relative;
    pointer-events: none;
}

.nsz-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 40px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: nsz-spin 0.8s linear infinite;
}

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

/* WooCommerce Blocks specific styles */
.wc-block-components-address-form .nsz-blocks-location-fields {
    margin: 16px 0;
}

.nsz-blocks-location-fields .nsz-field-wrapper {
    margin-bottom: 16px;
}

.nsz-blocks-location-fields label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #1e1e1e;
}

.nsz-blocks-location-fields .nsz-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background-color: #fff;
    font-size: 16px;
    line-height: 1.5;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.nsz-blocks-location-fields .nsz-select:hover {
    border-color: #1e1e1e;
}

.nsz-blocks-location-fields .nsz-select:focus {
    border-color: #007cba;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 1px #007cba;
}

.nsz-blocks-location-fields .nsz-select:disabled {
    background-color: #f0f0f0;
    color: #8c8f94;
    cursor: not-allowed;
}

/* Order details location display */
.nsz-order-location {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.nsz-order-location h2 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
}

.nsz-order-location address {
    font-style: normal;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .nsz-province-field,
    .nsz-district-field,
    .nsz-area-field {
        margin-bottom: 12px;
    }

    .nsz-province-field select,
    .nsz-district-field select,
    .nsz-area-field select {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* RTL Support */
[dir="rtl"] .nsz-blocks-location-fields .nsz-select {
    background-position: left 12px center;
    padding-right: 16px;
    padding-left: 40px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .nsz-order-location {
        background: #2d2d2d;
        color: #f0f0f0;
    }
}
