/* ==========================================================================
   4. FORM ELEMANLARI VE BUTONLAR
   ==========================================================================
*/

/* --------------------------------------------------------------------------
   4.1. Genel Form Elemanları
   -------------------------------------------------------------------------- */
.knsdd-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.knsdd-status-text {
    font-weight: bold;
    font-size: 13px;
}

.knsdd-status-text-active {
    color: #28a745;
}

.knsdd-status-text-inactive {
    color: #6c757d;
}

/* Info Tooltip Icon */
.knsdd-info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    color: #646970;
    cursor: help;
    vertical-align: middle;
    transition: color 0.15s ease;
}

.knsdd-info-tooltip:hover,
.knsdd-info-tooltip:focus-visible {
    color: #2271b1;
}

.knsdd-info-tooltip:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: 50%;
}

.knsdd-info-tooltip svg {
    width: 16px;
    height: 16px;
    display: block;
}

.knsdd-smart-tooltip-portal {
    position: fixed;
    z-index: 2147483647;
    box-sizing: border-box;
    width: max-content;
    max-width: min(320px, calc(100vw - 24px));
    padding: 7px 9px;
    border-radius: 3px;
    background: #50575e;
    color: #f6f7f7;
    box-shadow: 0 3px 12px rgba(44, 51, 56, 0.22);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
    contain: layout style;
}

/* Yapılandırılmış kampanya tooltip'i - yeşil */
.knsdd-info-tooltip-configured {
    color: #28a745;
}

.knsdd-info-tooltip-configured:hover {
    color: #1e7e34;
}

/* BOGO Mesaj Alt Sekmeleri */
.knsdd-bogo-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 0;
}

.knsdd-bogo-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #646970;
    position: relative;
    top: 1px;
}

.knsdd-bogo-tab:hover {
    background: #f6f7f7;
    color: #2271b1;
}

.knsdd-bogo-tab.is-active {
    border-bottom-color: #2271b1;
    color: #2271b1;
    font-weight: 600;
}

/* BOGO Bilgilendirme Kutuları */
.knsdd-bogo-overlap-info,
.knsdd-bogo-cart-info {
    margin-top: 16px;
    padding: 12px 16px;
    background: #e7f5fe;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

.knsdd-bogo-overlap-info .knsdd-info-box,
.knsdd-bogo-cart-info .knsdd-info-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.knsdd-bogo-overlap-info svg,
.knsdd-bogo-cart-info svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #2271b1;
    margin-top: 2px;
}

.knsdd-bogo-overlap-info p,
.knsdd-bogo-cart-info p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #1d2327;
}

.knsdd-bogo-overlap-info strong,
.knsdd-bogo-cart-info strong {
    color: #2271b1;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   4.2. Aksiyon Butonları (.knsdd-action-btn)
   -------------------------------------------------------------------------- */
/* Tüm ikon butonları için temel stil */
.knsdd-action-btn {
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    cursor: pointer;
    padding: 0;
    color: #50575e;
    text-decoration: none;
    width: 28px;
    height: 28px;
    border-radius: 3px;
    transition: all 0.1s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Inline SVG ikonlar için boyutlandırma */
.knsdd-action-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* *** DEĞİŞİKLİK BAŞLANGICI: İkon hover ve focus renkleri yeniden düzenlendi *** */

/* Varsayılan hover ve focus stili (Mavi) */
.knsdd-action-btn:hover {
    background: #fff;
    border-color: #999;
    color: #2271b1;
}

.knsdd-action-btn:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
    color: #2271b1;
}

/* Silme Butonları için Kırmızı Hover & Focus */
.knsdd-action-btn.knsdd-delete-rule:hover,
.knsdd-action-btn.knsdd-delete-group-action:hover {
    color: #dc3232;
}

.knsdd-action-btn.knsdd-delete-rule:focus,
.knsdd-action-btn.knsdd-delete-group-action:focus {
    border-color: #dc3232;
    box-shadow: 0 0 0 1px #dc3232;
    color: #dc3232;
}

/* Grup Kopyalama için Turuncu Hover & Focus */
.knsdd-action-btn.knsdd-duplicate-group-action:hover {
    color: #ffb900;
}

.knsdd-action-btn.knsdd-duplicate-group-action:focus {
    border-color: #ffb900;
    box-shadow: 0 0 0 1px #ffb900;
    color: #ffb900;
}

/* Kuralları Yönet için Yeşil Hover & Focus */
.knsdd-action-btn[title="Kuralları Yönet"]:hover {
    color: #4ab866;
}

.knsdd-action-btn[title="Kuralları Yönet"]:focus {
    border-color: #4ab866;
    box-shadow: 0 0 0 1px #4ab866;
    color: #4ab866;
}

/* Limitler için Camgöbeği Hover & Focus */
.knsdd-action-btn.knsdd-limits-rule:hover {
    color: #17a2b8;
}

.knsdd-action-btn.knsdd-limits-rule:focus {
    border-color: #17a2b8;
    box-shadow: 0 0 0 1px #17a2b8;
    color: #17a2b8;
}

/* Mesajlar için Pembe Hover & Focus */
.knsdd-action-btn.knsdd-messages-rule:hover {
    color: #d636be;
}

.knsdd-action-btn.knsdd-messages-rule:focus {
    border-color: #d636be;
    box-shadow: 0 0 0 1px #d636be;
    color: #d636be;
}

/* Deaktif Butonlar (Özel Kampanya Kopyala Butonu) */
.knsdd-action-btn.knsdd-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

.knsdd-action-btn.knsdd-btn-disabled:hover {
    background: #f0f0f0;
    border-color: #c3c4c7;
    color: inherit;
}

/* HTML disabled attribute ile devre dışı bırakılan butonlar */
.knsdd-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background: #f6f6f6;
}

.knsdd-action-btn:disabled:hover {
    background: #f6f6f6;
    border-color: #c3c4c7;
    color: #999;
}

/* PRO Özellik Butonları (Free kullanıcılar için) */
.knsdd-action-btn.knsdd-pro-feature-btn {
    position: relative;
    background: linear-gradient(135deg, #f6f7f7 0%, #e9ecef 100%);
}

.knsdd-action-btn.knsdd-pro-feature-btn:hover {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.knsdd-pro-badge-mini {
    position: absolute;
    top: -6px;
    right: -8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(255, 107, 107, 0.4);
}

/* *** DEĞİŞİKLİK SONU *** */

/* --------------------------------------------------------------------------
   4.3. Toggle Switch
   -------------------------------------------------------------------------- */
.knsdd-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    vertical-align: middle;
}

.knsdd-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.knsdd-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.knsdd-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.knsdd-toggle-slider {
    background-color: #28a745;
}

input:checked+.knsdd-toggle-slider:before {
    transform: translateX(26px);
}

/* Disabled state: interaksiyonu kapat ve görseli soluklaştır */
.knsdd-toggle-switch.is-disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.knsdd-toggle-switch.is-disabled .knsdd-toggle-slider {
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   4.4. Campaign Modal Field Widths
   - Modal içindeki sayısal inputları kompakt ve eşit genişlikte tut
   -------------------------------------------------------------------------- */
#knsdd-campaign-modal #knsdd-campaign-nth,
#knsdd-campaign-modal #knsdd-campaign-discount-value,
#knsdd-campaign-modal #knsdd-campaign-min-cart-total,
#knsdd-campaign-modal #knsdd-campaign-buy-x,
#knsdd-campaign-modal #knsdd-campaign-pay-y,
#knsdd-limits-modal #knsdd-total-limit,
#knsdd-limits-modal #knsdd-per-customer-limit {
    width: 100px;
    /* kompakt ve eşit genişlik */
    max-width: 100%;
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   4.5. Bilgilendirme Banner (Tier Group Info)
   -------------------------------------------------------------------------- */
.knsdd-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.knsdd-info-icon {
    flex-shrink: 0;
    color: #3b82f6;
    margin-top: 2px;
}

.knsdd-info-text {
    flex: 1;
}

.knsdd-info-text strong {
    display: block;
    color: #1e40af;
    margin-bottom: 6px;
    font-weight: 600;
}

.knsdd-info-text p {
    color: #475569;
    margin: 0;
}

/* RTL desteği */
[dir="rtl"] .knsdd-info-banner {
    border-left: none;
    border-right: 4px solid #3b82f6;
}

/* ==========================================================================
   5. KAMPANYA MODAL SEKMELERİ
   ==========================================================================
*/

/* Sekme başlıkları */
.knsdd-campaign-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    border-bottom: 2px solid #dcdcde;
}

.knsdd-campaign-tab {
    padding: 12px 20px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #50575e;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    margin-bottom: -2px;
}

.knsdd-campaign-tab:hover {
    background: #fff;
    color: #2271b1;
}

.knsdd-campaign-tab.active {
    background: #fff;
    border-color: #c3c4c7;
    border-bottom-color: #fff;
    color: #2271b1;
    font-weight: 600;
}

.knsdd-campaign-tab-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #2271b1;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.knsdd-campaign-tab.active .knsdd-campaign-tab-number {
    background: #135e96;
}

/* Sekme içerikleri */
.knsdd-campaign-tab-content {
    display: none;
    padding: 20px 0;
}

.knsdd-campaign-tab-content.active {
    display: block;
}

/* Radio grup */
.knsdd-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.knsdd-radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

.knsdd-radio-group input[type="radio"] {
    margin: 0;
}

/* Kampanya modal için özel form alanları */
.knsdd-campaign-form .knsdd-form-field {
    margin-bottom: 20px;
}

.knsdd-campaign-form .knsdd-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1d2327;
}

/* Modal içindeki Select2 kutucuklarının genişliğini sınırla */
#knsdd-campaign-modal .select2-container {
    max-width: 400px !important;
}

#knsdd-campaign-modal .select2-container--default .select2-selection--single {
    width: auto !important;
    min-width: 250px !important;
}

#knsdd-campaign-modal .select2-container--default .select2-selection--multiple {
    width: auto !important;
    max-width: 100% !important;
}

.knsdd-campaign-form .knsdd-form-field .description {
    margin-top: 6px;
    font-size: 12px;
    color: #646970;
    font-style: italic;
}

.knsdd-campaign-form input[type="number"] {
    width: 100px;
}

/* Select2 wrapper kampanya modalı için */
.knsdd-campaign-form .knsdd-product-select-wrapper,
.knsdd-campaign-form .knsdd-category-select-wrapper {
    margin-top: 8px;
}

.knsdd-campaign-form .knsdd-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

/* Modal clear buton stilleri kaldırıldı - vendors-overrides.css'den gelecek */

/* RTL desteği - Sekmeler */
[dir="rtl"] .knsdd-campaign-tabs {
    flex-direction: row-reverse;
}

[dir="rtl"] .knsdd-campaign-tab {
    flex-direction: row-reverse;
}

[dir="rtl"] .knsdd-radio-group {
    flex-direction: row-reverse;
}
