/**
 * WooCommerce Türkiye Fatura & Vergi Checkout & Thank You Stilleri
 */

/* İstenmeyen Fazlalıkları Kesin Olarak Gizle / Kaldır */
.woocommerce-additional-fields,
.woocommerce-additional-fields__field-wrapper,
#order_comments_field,
#billing_address_2_field,
#shipping_address_2_field,
.woocommerce-shipping-destination,
p.woocommerce-shipping-destination,
.shipping-calculator-button,
a.shipping-calculator-button,
.shipping-calculator-form,
.woocommerce-shipping-calculator {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
}

/* Posta Kodu Hariç Hiçbir Alanda "(isteğe bağlı)" Yazmasın */
.woocommerce-billing-fields .form-row:not(#billing_postcode_field) .optional,
.woocommerce-billing-fields .form-row:not(#billing_postcode_field) label .optional,
.woocommerce-billing-fields p:not(#billing_postcode_field) .optional,
.woocommerce-shipping-fields .form-row:not(#shipping_postcode_field) .optional,
.woocommerce-shipping-fields .form-row:not(#shipping_postcode_field) label .optional,
.woocommerce-shipping-fields p:not(#shipping_postcode_field) .optional {
    display: none !important;
    visibility: hidden !important;
}

/* Farklı Bir Adrese Gönder Onay Kutusu ve Başlığı */
#ship-to-different-address {
    background: #f8fafc !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin-top: 25px !important;
    margin-bottom: 15px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

#ship-to-different-address:hover {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
}

#ship-to-different-address label {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
}

#ship-to-different-address input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    margin: 0 8px 0 0 !important;
    cursor: pointer !important;
    accent-color: #2563eb !important;
}

/* Fatura Türü Seçici */
#billing_invoice_type_field.wc-tr-invoice-type-wrapper {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 16px !important;
    box-shadow: none !important;
}

#billing_invoice_type_field label {
    font-weight: 600 !important;
    color: #1e293b !important;
    font-size: 14px !important;
    margin-bottom: 6px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

#billing_invoice_type_field label::before {
    content: "🧾";
    font-size: 15px;
}

#billing_invoice_type_field select {
    background-color: #f8fafc !important;
    border: 1.5px solid #3b82f6 !important;
    color: #1e3a8a !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

/* ==========================================================================
   Tüm Form Elemanlarının Boyut ve Tipografi Standartlaştırılması (Normalization)
   ========================================================================== */
.woocommerce-checkout form .form-row input.input-text,
.woocommerce-checkout form .form-row input[type="text"],
.woocommerce-checkout form .form-row input[type="tel"],
.woocommerce-checkout form .form-row input[type="email"],
.woocommerce-checkout form .form-row select,
.woocommerce-checkout form .form-row textarea,
.woocommerce-checkout .select2-container--default .select2-selection--single {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    min-height: 44px !important;
    height: 44px !important;
    padding: 9px 14px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background-color: #ffffff !important;
    color: #1e293b !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    margin: 0 !important;
}

/* Textarea İçin Yükseklik İstisnası */
.woocommerce-checkout form .form-row textarea,
#billing_address_1_field textarea,
#shipping_address_1_field textarea,
textarea#billing_address_1,
textarea#shipping_address_1 {
    min-height: 85px !important;
    height: 85px !important;
    padding: 10px 14px !important;
    resize: vertical !important;
}

/* Focus / Odaklanma Efekti */
.woocommerce-checkout form .form-row input.input-text:focus,
.woocommerce-checkout form .form-row input[type="text"]:focus,
.woocommerce-checkout form .form-row input[type="tel"]:focus,
.woocommerce-checkout form .form-row input[type="email"]:focus,
.woocommerce-checkout form .form-row select:focus,
.woocommerce-checkout form .form-row textarea:focus,
.woocommerce-checkout .select2-container--default.select2-container--open .select2-selection--single,
.woocommerce-checkout .select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

/* Select2 / Dropdown İçi Hizalama */
.woocommerce-checkout .select2-container--default .select2-selection--single {
    display: flex !important;
    align-items: center !important;
}

.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px !important;
    padding-left: 0 !important;
    color: #1e293b !important;
}

.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px !important;
    right: 8px !important;
}

/* Form Label Başlıkları */
.woocommerce-checkout form .form-row label {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: #334155 !important;
    margin-bottom: 5px !important;
    display: block !important;
    line-height: 1.4 !important;
}

.woocommerce-checkout form .form-row {
    margin-bottom: 14px !important;
    padding: 0 !important;
}

#billing_tc_kimlik_field .description {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    display: block;
}

/* ==========================================================================
   Gizli Alanlar (Bireysel / Kurumsal Geçişleri İçin Kesin Kural)
   ========================================================================== */
.wc-tr-hidden,
.woocommerce-checkout .form-row.wc-tr-hidden,
.woocommerce-checkout #customer_details .form-row.wc-tr-hidden,
.woocommerce-checkout .form-row[style*="display: none"],
.woocommerce-checkout .form-row[style*="display:none"],
.woocommerce-checkout #customer_details .form-row[style*="display: none"],
.woocommerce-checkout #customer_details .form-row[style*="display:none"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    min-height: 0 !important;
    opacity: 0 !important;
}

/* ==========================================================================
   Izgara Düzeni ve Sıralama (Flex Order Grid - Her Temada Mükemmel 2 Kolon)
   ========================================================================== */
.woocommerce-billing-fields__field-wrapper,
.woocommerce-shipping-fields__field-wrapper,
.woocommerce-billing-fields,
.woocommerce-shipping-fields,
.shipping_address {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 2 Kolonlu Alanlar (Ad/Soyad, Telefon/Eposta, Şehir/İlçe, Vergi Dairesi/No) */
#billing_first_name_field,
#billing_last_name_field,
#billing_tax_office_field,
#billing_tax_number_field,
#billing_phone_field,
#billing_email_field,
#billing_state_field,
#billing_city_field,
#shipping_first_name_field,
#shipping_last_name_field,
#shipping_state_field,
#shipping_city_field,
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-first:not(.wc-tr-hidden),
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-last:not(.wc-tr-hidden),
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row-first:not(.wc-tr-hidden),
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row-last:not(.wc-tr-hidden) {
    width: 48.5% !important;
    max-width: 48.5% !important;
    flex: 0 0 48.5% !important;
    box-sizing: border-box !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    clear: none !important;
}

/* Tam Genişlik Alanlar */
#billing_invoice_type_field,
#billing_company_field,
#billing_tc_kimlik_field,
#billing_authorized_person_field,
#billing_country_field,
#billing_neighborhood_field,
#billing_address_1_field,
#billing_postcode_field,
#shipping_phone_field,
#shipping_country_field,
#shipping_neighborhood_field,
#shipping_address_1_field,
#shipping_postcode_field,
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-wide:not(.wc-tr-hidden),
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row-wide:not(.wc-tr-hidden) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    box-sizing: border-box !important;
    clear: both !important;
}

/* Fatura Flex Sıralamaları */
#billing_invoice_type_field      { order: 1 !important; }
#billing_first_name_field        { order: 2 !important; }
#billing_last_name_field         { order: 3 !important; }
#billing_tc_kimlik_field         { order: 4 !important; }
#billing_company_field           { order: 5 !important; }
#billing_tax_office_field        { order: 6 !important; }
#billing_tax_number_field        { order: 7 !important; }
#billing_authorized_person_field { order: 8 !important; }
#billing_phone_field             { order: 9 !important; }
#billing_email_field             { order: 10 !important; }
#billing_country_field           { order: 11 !important; }
#billing_state_field             { order: 12 !important; }
#billing_city_field              { order: 13 !important; }
#billing_neighborhood_field      { order: 14 !important; }
#billing_address_1_field         { order: 15 !important; }
#billing_postcode_field          { order: 16 !important; }

/* Gönderim Flex Sıralamaları */
#shipping_first_name_field       { order: 1 !important; }
#shipping_last_name_field        { order: 2 !important; }
#shipping_phone_field            { order: 3 !important; }
#shipping_country_field          { order: 4 !important; }
#shipping_state_field            { order: 5 !important; }
#shipping_city_field             { order: 6 !important; }
#shipping_neighborhood_field     { order: 7 !important; }
#shipping_address_1_field        { order: 8 !important; }
#shipping_postcode_field         { order: 9 !important; }

/* Gönderim Flex Sıralamaları */
#shipping_first_name_field       { order: 1 !important; }
#shipping_last_name_field        { order: 2 !important; }
#shipping_phone_field            { order: 3 !important; }
#shipping_country_field          { order: 4 !important; }
#shipping_state_field            { order: 5 !important; }
#shipping_city_field             { order: 6 !important; }
#shipping_neighborhood_field     { order: 7 !important; }
#shipping_address_1_field        { order: 8 !important; }
#shipping_postcode_field         { order: 9 !important; }

/* Mobil Uyum */
@media (max-width: 768px) {
    #billing_first_name_field,
    #billing_last_name_field,
    #billing_tax_office_field,
    #billing_tax_number_field,
    #billing_phone_field,
    #billing_email_field,
    #billing_state_field,
    #billing_city_field,
    #shipping_first_name_field,
    #shipping_last_name_field,
    #shipping_state_field,
    #shipping_city_field,
    .woocommerce-checkout .form-row-first,
    .woocommerce-checkout .form-row-last {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-right: 0 !important;
    }
}

/* Başarılı Ödeme (Thank You) ve Sipariş Detay Sayfası Stilleri */
.wc-tr-frontend-invoice-section {
    clear: both;
}

.wc-tr-frontend-invoice-section table tr td {
    border: none !important;
}

/* Standart Mükerrer Fatura Adresi Bloğunu Gizle */
.woocommerce-order-received .woocommerce-customer-details:not(.wc-tr-frontend-invoice-section),
.woocommerce-view-order .woocommerce-customer-details:not(.wc-tr-frontend-invoice-section),
.woocommerce-page .woocommerce-order-details + .woocommerce-customer-details:not(.wc-tr-frontend-invoice-section) {
    display: none !important;
}

