/**
 * ThanhLuanWP - Checkout Styles
 * Style cho các dropdown và form trên trang Checkout
 * 
 * @package ThanhLuanWP_VN_Address_Hybrid
 */
.woocommerce-billing-fields__field-wrapper {
    display: table;
    width: 100%;
}

/* ============================================
   Address Wrapper
   ============================================ */
.thanhluanwp-address-wrapper {
    margin-top: 20px;
}

/* ============================================
   Address Group (Box chứa địa chỉ)
   ============================================ */
.thanhluanwp-address-group {
    margin-bottom: 25px;
    padding: 20px 25px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.thanhluanwp-address-group:hover {
    border-color: #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Địa chỉ mới - Style xanh lá */
.thanhluanwp-address-new {
    background: linear-gradient(180deg, #f0fdf4 0%, #f8f9fa 100%);
    border-color: #86efac;
}

.thanhluanwp-address-new:hover {
    border-color: #4ade80;
}

/* Địa chỉ cũ - Style cam */
.thanhluanwp-address-old {
    background: linear-gradient(180deg, #fffbeb 0%, #f8f9fa 100%);
    border-color: #fcd34d;
}

.thanhluanwp-address-old:hover {
    border-color: #fbbf24;
}

/* ============================================
   Group Title
   ============================================ */
.thanhluanwp-address-group-title {
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

.thanhluanwp-address-new .thanhluanwp-address-group-title {
    color: #166534;
    border-bottom-color: #86efac;
}

.thanhluanwp-address-old .thanhluanwp-address-group-title {
    color: #92400e;
    border-bottom-color: #fcd34d;
}

.thanhluanwp-address-group-title .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.thanhluanwp-optional {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    margin-left: auto;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ============================================
   Form Fields
   ============================================ */
.thanhluanwp-address-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.thanhluanwp-address-fields .form-row {
    margin: 0;
    flex: 1 1 calc(50% - 8px);
    min-width: 200px;
}

.thanhluanwp-address-fields .form-row-wide {
    flex: 1 1 100%;
}

.thanhluanwp-address-fields .form-row label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.thanhluanwp-address-fields .form-row .required {
    color: #dc2626;
}

/* ============================================
   Select Dropdowns
   ============================================ */
.thanhluanwp-address-fields select,
.thanhluanwp-field select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thanhluanwp-address-fields select:hover,
.thanhluanwp-field select:hover {
    border-color: #9ca3af;
}

.thanhluanwp-address-fields select:focus,
.thanhluanwp-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Select trong địa chỉ mới */
.thanhluanwp-address-new select:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

/* Select trong địa chỉ cũ */
.thanhluanwp-address-old select:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

/* ============================================
   Text Inputs
   ============================================ */
.thanhluanwp-address-fields input[type="text"],
.thanhluanwp-field input[type="text"],
.thanhluanwp-address-fields input[type="email"],
.thanhluanwp-address-fields input[type="tel"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.thanhluanwp-address-fields input:hover,
.thanhluanwp-field input:hover {
    border-color: #9ca3af;
}

.thanhluanwp-address-fields input:focus,
.thanhluanwp-field input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Input trong địa chỉ mới */
.thanhluanwp-address-new input:focus {
    border-color: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}

/* Input trong địa chỉ cũ */
.thanhluanwp-address-old input:focus {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

/* Placeholder */
.thanhluanwp-address-fields input::placeholder,
.thanhluanwp-field input::placeholder {
    color: #9ca3af;
}

/* ============================================
   Validation States
   ============================================ */
.thanhluanwp-address-fields .woocommerce-invalid input,
.thanhluanwp-address-fields .woocommerce-invalid select {
    border-color: #dc2626 !important;
}

.thanhluanwp-address-fields .woocommerce-validated input,
.thanhluanwp-address-fields .woocommerce-validated select {
    border-color: #16a34a !important;
}

/* ============================================
   Loading State
   ============================================ */
.thanhluanwp-loading {
    position: relative;
    pointer-events: none;
}

.thanhluanwp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 40px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: thanhluanwp-spin 0.8s linear infinite;
}

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

/* ============================================
   Billing Fields Override
   ============================================ */
#billing_full_name_field {
    margin-bottom: 15px;
}

#billing_full_name_field label {
    font-size: 14px;
    font-weight: 600;
    color: #1e1e1e;
}

#billing_full_name_field input {
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 500;
}

/* Phone và Email fields */
#billing_phone_field,
#billing_email_field {
    margin-bottom: 15px;
}

/* ============================================
   Responsive
   ============================================ */
@media screen and (max-width: 768px) {
    .thanhluanwp-address-group {
        padding: 15px 18px;
    }

    .thanhluanwp-address-fields .form-row {
        flex: 1 1 100%;
    }

    .thanhluanwp-address-group-title {
        font-size: 15px;
    }

    .thanhluanwp-optional {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .thanhluanwp-address-group {
        padding: 12px 15px;
        border-radius: 8px;
    }

    .thanhluanwp-address-fields select,
    .thanhluanwp-address-fields input {
        padding: 10px 12px;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }
}

/* ============================================
   Select2 Compatibility
   ============================================ */
.thanhluanwp-address-fields .select2-container {
    width: 100% !important;
}

.thanhluanwp-address-fields .select2-container .select2-selection--single {
    height: auto;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
}

.thanhluanwp-address-fields .select2-container--focus .select2-selection--single {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.thanhluanwp-address-fields .select2-container .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
}

.thanhluanwp-address-fields .select2-container .select2-selection__arrow {
    height: 100%;
    top: 0;
    right: 8px;
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Có thể thêm dark mode styles tại đây nếu theme hỗ trợ */
}