.wtc-contracts-wrapper {
    margin: 1em 0;
}

.wtc-contract-link {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.wtc-contract-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.wtc-contract-link.active {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Modal Styles */
.wtc-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    inset: 0; /* top, right, bottom, left hepsini 0 yapar */
}

.wtc-modal[aria-hidden="false"] {
    display: flex;
}

.wtc-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s ease-out;
}

.wtc-modal-wrapper {
    position: relative;
    margin: auto;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Taşan içeriği gizle */
}

.wtc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.wtc-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.wtc-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    -webkit-overflow-scrolling: touch;
    max-height: calc(90vh - 140px);
    margin-bottom: 0; /* Footer ile arasında boşluk bırakma */
}

.wtc-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 8px 8px;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    margin-top: auto; /* Üst kısımla otomatik boşluk */
}

.wtc-modal-footer button {
    min-width: 100px;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.wtc-close {
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s;
}

.wtc-close:hover {
    color: #1f2937;
}

.wtc-modal-accept {
    background-color: var(--primary, #2271b1) !important;
    color: #fff !important;
    border-color: var(--primary, #2271b1) !important;
}

.wtc-modal-accept:hover {
    background-color: var(--primary-hover, #135e96) !important;
    border-color: var(--primary-hover, #135e96) !important;
}

.wtc-modal-close {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border-color: #e5e7eb !important;
}

.wtc-modal-close:hover {
    background-color: #e5e7eb !important;
    border-color: #d1d5db !important;
}

/* Animasyonlar */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobil düzenlemeler */
@media (max-width: 640px) {
    .wtc-modal-wrapper {
        width: 95%;
        margin: 1rem auto;
    }
    
    .wtc-modal-body {
        max-height: calc(100vh - 200px);
    }
}

/* Focus yönetimi için */
.wtc-modal-wrapper:focus {
    outline: none;
}

.wtc-modal-wrapper *:focus {
    outline: 2px solid var(--primary, #2271b1);
    outline-offset: 2px;
}

#wtc-contract-content {
    flex: 1;
    overflow-y: visible;
    overflow-x: hidden;
    padding: 20px 15px;
    margin-top: 10px;
    margin-bottom: 20px;
}

/* Responsive düzenlemeler */
@media (max-width: 768px) {
    .wtc-modal-wrapper {
        width: 95%;
        margin: 10px auto;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }
    
    .wtc-modal-body {
        max-height: calc(85vh - 180px); /* Footer için daha fazla alan bırak */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .wtc-modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        position: sticky;
        bottom: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .wtc-modal-footer button {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
        margin: 0;
    }
}

/* Scrollbar stilini özelleştir */
#wtc-contract-content::-webkit-scrollbar {
    width: 8px;
}

#wtc-contract-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#wtc-contract-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#wtc-contract-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Sözleşme metin alanı düzenlemeleri */
.wtc-contract-text {
    margin: 1em 0;
    padding: 1em;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.wtc-contract-text .wtc-contract-content {
    max-height: 300px; /* Masaüstü için varsayılan yükseklik */
    overflow-y: auto;
    padding-right: 10px;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar stilleri */
.wtc-contract-text .wtc-contract-content::-webkit-scrollbar {
    width: 8px;
}

.wtc-contract-text .wtc-contract-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wtc-contract-text .wtc-contract-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.wtc-contract-text .wtc-contract-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobil düzenlemeler */
@media (max-width: 768px) {
    .wtc-contract-text {
        margin: 0.5em 0;
        padding: 0.75em;
    }

    .wtc-contract-text .wtc-contract-content {
        max-height: 200px; /* Mobil için daha küçük yükseklik */
        padding-right: 5px;
    }
    
    /* Mobilde daha ince scrollbar */
    .wtc-contract-text .wtc-contract-content::-webkit-scrollbar {
        width: 4px;
    }
}

/* Küçük ekranlar için ek düzenleme */
@media (max-width: 480px) {
    .wtc-contract-text .wtc-contract-content {
        max-height: 250px; /* Çok küçük ekranlar için daha da az yükseklik */
    }
}

/* Tablo düzenlemeleri */
.wtc-contract-content table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.wtc-contract-content table td,
.wtc-contract-content table th {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    word-break: break-word;
}

/* Mobil için tablo düzenlemeleri */
@media (max-width: 768px) {
    .wtc-contract-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    /* Sadece tablo için yatay kaydırma çubuğu */
    .wtc-contract-content table::-webkit-scrollbar {
        height: 6px;
    }
    
    .wtc-contract-content table::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .wtc-contract-content table::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
}

/* Genel metin düzenlemeleri */
.wtc-contract-content p,
.wtc-contract-content div,
.wtc-contract-content span,
.wtc-contract-content li {
    max-width: 100%;
    word-wrap: break-word;
    white-space: normal;
}

/* Liste düzenlemeleri */
.wtc-contract-content ul,
.wtc-contract-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Başlık düzenlemeleri */
.wtc-contract-content h1,
.wtc-contract-content h2,
.wtc-contract-content h3,
.wtc-contract-content h4,
.wtc-contract-content h5,
.wtc-contract-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

/* Modal açıkken body scroll'u engelle */
body.modal-open {
    overflow: hidden;
    padding-right: 15px; /* Scrollbar genişliği kadar padding ekle */
}

/* Aktif link için stil */
.wtc-contract-link.active {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Sözleşme container stilleri */
.wtc-contract-container[data-mode="popup"] .wtc-contract-text {
    display: none;
}

.wtc-contract-container[data-mode="text"] .wtc-contract-link {
    pointer-events: none;
    text-decoration: none;
    color: inherit;
    cursor: default;
}

/* Modal erişilebilirlik iyileştirmeleri */
.wtc-modal:not([aria-hidden="true"]) {
    pointer-events: auto;
}

.wtc-modal[aria-hidden="true"] {
    pointer-events: none;
    visibility: hidden;
}

/* Focus görünürlüğü için outline stilleri */
.wtc-modal button:focus,
.wtc-modal [href]:focus,
.wtc-modal input:focus,
.wtc-modal select:focus,
.wtc-modal textarea:focus,
.wtc-modal [tabindex]:not([tabindex="-1"]):focus {
    outline: 2px solid var(--primary, #2271b1);
    outline-offset: 2px;
}

/* Modal içeriği için z-index düzenlemesi */
.wtc-modal-wrapper {
    z-index: 1000000;
    position: relative;
}

.wtc-modal-overlay {
    z-index: 999999;
}

/* Mobil cihazlar için ek düzenlemeler */
@media (max-width: 768px) {
    .wtc-modal-wrapper {
        width: 95%;
        margin: 10px auto;
        max-height: 85vh;
    }
    
    .wtc-modal-body {
        max-height: calc(85vh - 120px);
        -webkit-overflow-scrolling: touch; /* iOS için daha iyi kaydırma */
    }
    
    /* Mobilde butonları daha kolay tıklanabilir yap */
    .wtc-modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .wtc-modal-footer button {
        width: 100%;
        min-height: 44px;
        font-size: 1rem;
        margin: 0;
    }
}

/* Modal içerik alanı düzeltmeleri */
.wtc-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 90vh;
    position: relative; /* Footer için gerekli */
}

/* Scrollbar stilleri */
.wtc-modal-body::-webkit-scrollbar {
    width: 8px;
}

.wtc-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.wtc-modal-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.wtc-modal-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Tablo stilleri için ortak CSS */
.wtc-products-table,
.wtc-order-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    border: 1px solid var(--table-border-color, #dee2e6);
}

.wtc-products-table th,
.wtc-products-table td,
.wtc-order-summary-table th,
.wtc-order-summary-table td {
    padding: 8px;
    border: 1px solid var(--table-border-color, #dee2e6);
}

.wtc-products-table th,
.wtc-order-summary-table th {
    background-color: var(--table-header-bg, #f8f8f8);
    font-weight: bold;
    text-align: left;
}

.wtc-products-table td,
.wtc-order-summary-table td {
    vertical-align: middle;
}

/* Hücre hizalamaları */
.wtc-products-table td:nth-child(2),
.wtc-order-summary-table td:nth-child(2) {
    text-align: center;
}

.wtc-products-table td:nth-child(3),
.wtc-products-table td:nth-child(4),
.wtc-order-summary-table td:nth-child(3),
.wtc-order-summary-table td:nth-child(4) {
    text-align: right;
}

/* Özet satırları için stil */
.wtc-order-summary-table tr.summary-row td {
    text-align: right;
    font-weight: normal;
}

.wtc-order-summary-table tr.summary-row.total td {
    font-weight: bold;
    background-color: var(--table-header-bg, #f8f8f8);
    border-top: 2px solid var(--table-border-color, #dee2e6);
}

/* Responsive tasarım */
@media screen and (max-width: 768px) {
    .wtc-products-table,
    .wtc-order-summary-table {
        font-size: 14px;
    }
    
    .wtc-products-table th,
    .wtc-products-table td,
    .wtc-order-summary-table th,
    .wtc-order-summary-table td {
        padding: 6px;
    }
}

/* Sözleşme linkleri için stil */
.wtc-contract-links {
    margin: 20px 0;
    padding: 15px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wtc-contract-links h3 {
    margin-bottom: 15px;
}

.wtc-contract-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wtc-contract-links li {
    margin-bottom: 10px;
}

.wtc-contract-links .button {
    display: inline-block;
    padding: 8px 15px;
    text-decoration: none;
}

/* Sözleşme butonları için temel stiller */
.wtc-contracts {
    margin: 20px 0;
}

.wtc-contracts-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.wtc-contract-btn {
    padding: 10px 15px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}

.wtc-contract-btn:hover {
    background: #f0f0f0;
}

@media (max-width: 768px) {
    .wtc-contracts-grid {
        flex-direction: column;
    }
}