/* WC Auto Ongkir - Frontend Checkout Styles */

/* =============================================
   COURIER SELECTOR
   ============================================= */

.wcao-courier-selector-row th {
    padding-top: 14px !important;
    font-weight: 600;
}

.wcao-courier-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}

.wcao-courier-option {
    display: inline-flex;
    cursor: pointer;
    margin: 0 !important;
}

.wcao-courier-option input[type="radio"] {
    display: none;
}

.wcao-courier-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    background: #fff;
    transition: all 0.2s ease;
    user-select: none;
}

.wcao-courier-label:hover {
    border-color: #2271b1;
    color: #2271b1;
    background: #f5f9ff;
}

.wcao-courier-option.active .wcao-courier-label,
.wcao-courier-option input[type="radio"]:checked + .wcao-courier-label {
    border-color: #2271b1;
    background: linear-gradient(135deg, #e8f0fe 0%, #dce8f9 100%);
    color: #1a56a0;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(34, 113, 177, 0.15);
}

.wcao-courier-icon {
    font-size: 16px;
    line-height: 1;
}

.wcao-courier-name {
    line-height: 1;
}

/* =============================================
   SHIPPING METHOD LABELS
   ============================================= */

.woocommerce-shipping-methods .shipping_method + label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

/* =============================================
   ONGKIR INFO BADGE
   ============================================= */

.wcao-shipping-info {
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f0fe 100%);
    border: 1px solid #c8ddf5;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 13px;
    color: #1a3a5c;
}

.wcao-shipping-info .wcao-zone-label {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.wcao-shipping-info .wcao-est-days {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

/* =============================================
   FREE SHIPPING BADGE
   ============================================= */

.wcao-free-badge {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 700;
    margin-left: 6px;
    animation: wcao-pulse 2s infinite;
}

@keyframes wcao-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* =============================================
   LOADING STATE
   ============================================= */

.wcao-loading-shipping {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    color: #666;
    font-size: 13px;
}

.wcao-loading-shipping::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: wcao-spin 0.8s linear infinite;
}

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

/* =============================================
   CITY SELECT (CONVERTED FROM INPUT)
   ============================================= */

.wcao-city-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: auto;
    -webkit-appearance: auto;
}

.wcao-city-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
    outline: none;
}

/* =============================================
   FORM FIELD ENHANCEMENTS
   ============================================= */

#shipping_state_field select,
#billing_state_field select,
#shipping_city_field input,
#billing_city_field input,
#shipping_city_field select,
#billing_city_field select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#shipping_state_field select:focus,
#billing_state_field select:focus,
#shipping_city_field select:focus,
#billing_city_field select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

/* =============================================
   DISTRICT SELECT (KECAMATAN)
   ============================================= */

.wcao-district-wrapper {
    margin-top: 10px;
}

.wcao-district-wrapper label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.wcao-district-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wcao-district-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
    outline: none;
}

/* =============================================
   GPS AUTO-LOCATION BUTTON
   ============================================= */

.wcao-gps-wrapper {
    margin-bottom: 16px;
}

.wcao-gps-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 2px solid #2271b1;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #2271b1 0%, #1a56a0 50%, #135a96 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(34, 113, 177, 0.25);
    width: 100%;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.wcao-gps-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}

.wcao-gps-btn:hover::before {
    left: 100%;
}

.wcao-gps-btn:hover {
    background: linear-gradient(135deg, #1a56a0 0%, #135a96 50%, #0e4a7d 100%);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(34, 113, 177, 0.35);
}

.wcao-gps-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(34, 113, 177, 0.25);
}

.wcao-gps-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.wcao-gps-icon {
    font-size: 18px;
    line-height: 1;
}

.wcao-gps-text {
    line-height: 1;
}

/* GPS Status Messages */
.wcao-gps-status {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    animation: wcao-fade-in 0.3s ease;
}

@keyframes wcao-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wcao-gps-loading {
    color: #2271b1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wcao-gps-status:has(.wcao-gps-loading) {
    background: #f0f7ff;
    border: 1px solid #c8ddf5;
}

.wcao-gps-success {
    color: #166534;
}

.wcao-gps-status:has(.wcao-gps-success) {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #a7f3d0;
}

.wcao-gps-error {
    color: #991b1b;
}

.wcao-gps-status:has(.wcao-gps-error) {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
}

/* Fallback for browsers without :has() */
.wcao-gps-status {
    background: #f8f9fa;
    border: 1px solid #e2e5e9;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media screen and (max-width: 600px) {
    .wcao-courier-options {
        flex-direction: column;
    }

    .wcao-courier-label {
        width: 100%;
        justify-content: center;
    }

    .wcao-gps-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
}
