/* ========== WAREHOUSE TABLE ENGINE STYLES WITH I18N SUPPORT ========== */

.wte-wrapper {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #333;
}

/* ========== TOOLBAR STYLES ========== */
.wte-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

.wte-search-container {
    position: relative;
    min-width: 250px;
    flex: 1;
    max-width: 400px;
}

.wte-search {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

/* RTL support for search input */
[dir="rtl"] .wte-search {
    padding: 8px 12px 8px 35px;
}

.wte-search:focus {
    outline: none;
    border-color: #4059b1;
    box-shadow: 0 0 0 2px rgba(97, 148, 251, 0.25);
}

.wte-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* RTL support for search icon */
[dir="rtl"] .wte-search-icon {
    right: auto;
    left: 10px;
}

.wte-export-container {
    position: relative;
}

.wte-export-btn {
    background: #4059b1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    min-width: 100px;
}

/* Language-specific export button sizing */
.wte-wrapper[data-lang="en"] .wte-export-btn {
    min-width: 100px; /* "Export ▼" */
}

.wte-wrapper[data-lang="de"] .wte-export-btn {
    min-width: 120px; /* "Exportieren ▼" */
}

.wte-wrapper[data-lang="fr"] .wte-export-btn {
    min-width: 110px; /* "Exporter ▼" */
}

.wte-wrapper[data-lang="ru"] .wte-export-btn {
    min-width: 115px; /* "Экспорт ▼" */
}

.wte-export-btn:hover {
    background: #4059b1;
}

.wte-export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

/* RTL support for export menu */
[dir="rtl"] .wte-export-menu {
    right: auto;
    left: 0;
}

.wte-export-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.wte-export-menu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    white-space: nowrap;
}

/* RTL support for export menu buttons */
[dir="rtl"] .wte-export-menu button {
    text-align: right;
}

.wte-export-menu button:hover {
    background: #f8f9fa;
}

.wte-export-menu button:first-child {
    border-radius: 6px 6px 0 0;
}

.wte-export-menu button:last-child {
    border-radius: 0 0 6px 6px;
}

/* ========== INFO BAR STYLES ========== */
.wte-info-bar {
    margin-bottom: 15px;
}

.wte-last-modified {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wte-last-modified-label {
    font-weight: 600;
    margin-right: 8px;
}

/* RTL support for last modified label */
[dir="rtl"] .wte-last-modified-label {
    margin-right: 0;
    margin-left: 8px;
}

.wte-last-modified-date {
    color: #495057;
}

/* ========== TABLE STYLES ========== */
.wte-table-container {
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.wte-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    direction: ltr; /* Force LTR for data tables even in RTL layouts */
}

/* RTL override for table direction when needed */
.wte-table[data-table-dir="rtl"] {
    direction: rtl;
}

.wte-thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.wte-th {
    padding: 0;
    border-right: 1px solid #dee2e6;
    text-align: left;
    font-weight: 600;
    color: #495057;
    position: relative;
}

/* RTL support for table headers */
[dir="rtl"] .wte-th {
    text-align: right;
    border-right: none;
    border-left: 1px solid #dee2e6;
}

.wte-th:last-child {
    border-right: none;
}

/* RTL support for last header */
[dir="rtl"] .wte-th:last-child {
    border-left: none;
}

.wte-th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    transition: background-color 0.2s ease;
    min-height: 20px;
}

.wte-th.sortable .wte-th-content {
    cursor: pointer;
}

.wte-th.sortable .wte-th-content:hover {
    background: rgba(97, 148, 251, 0.05);
}

.wte-th-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.wte-sort-icon {
    display: flex;
    flex-direction: column;
    margin-left: 8px;
    font-size: 10px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

/* RTL support for sort icon */
[dir="rtl"] .wte-sort-icon {
    margin-left: 0;
    margin-right: 8px;
}

.wte-sort-icon.active {
    opacity: 1;
}

.wte-sort-icon.asc .sort-desc,
.wte-sort-icon.desc .sort-asc {
    opacity: 0.3;
}

.wte-tbody {
    background: white;
}

.wte-row {
    transition: background-color 0.2s ease;
}

.wte-row:hover {
    background: #f8f9fa;
}

.wte-row.even {
    background: #fbfbfb;
}

.wte-row.even:hover {
    background: #f0f0f0;
}

.wte-td {
    padding: 12px 15px;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    vertical-align: top;
    word-wrap: break-word;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* RTL support for table cells */
[dir="rtl"] .wte-td {
    border-right: none;
    border-left: 1px solid #dee2e6;
}

.wte-td:last-child {
    border-right: none;
}

/* RTL support for last cell */
[dir="rtl"] .wte-td:last-child {
    border-left: none;
}

.wte-no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

.wte-no-data td {
    padding: 40px 20px;
}

/* ========== FOOTER STYLES ========== */
.wte-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.wte-per-page label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    white-space: nowrap;
}

.wte-per-page-select {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 60px;
}

.wte-info-text {
    color: #6c757d;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.wte-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.wte-pagination-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 80px;
}

/* Language-specific pagination button sizing */
.wte-wrapper[data-lang="en"] .wte-pagination-btn {
    min-width: 80px; /* "Previous", "Next" */
}

.wte-wrapper[data-lang="de"] .wte-pagination-btn {
    min-width: 90px; /* "Vorherige", "Nächste" */
}

.wte-wrapper[data-lang="fr"] .wte-pagination-btn {
    min-width: 95px; /* "Précédente", "Suivante" */
}

.wte-wrapper[data-lang="ru"] .wte-pagination-btn {
    min-width: 100px; /* "Предыдущая", "Следующая" */
}

.wte-pagination-btn:hover:not(:disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.wte-pagination-btn:disabled {
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.wte-pagination-numbers {
    display: flex;
    gap: 2px;
    margin: 0 10px;
    flex-wrap: wrap;
}

.wte-page-number {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
}

.wte-page-number:hover {
    background: rgba(97, 148, 251, 0.1);
    border-color: #4059b1;
}

.wte-page-number.active {
    background: #4059b1;
    color: white;
    border-color: #4059b1;
}

.wte-pagination-dots {
    padding: 8px 4px;
    color: #6c757d;
    font-size: 14px;
}

/* ========== NOTIFICATION STYLES ========== */
.wte-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4059b1;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    font-size: 14px;
    max-width: 300px;
    word-wrap: break-word;
}

/* RTL support for notifications */
[dir="rtl"] .wte-notification {
    right: auto;
    left: 20px;
    transform: translateX(-400px);
}

.wte-notification.show {
    transform: translateX(0);
}

/* ========== RESPONSIVE STYLES ========== */
@media (max-width: 768px) {
    .wte-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .wte-search-container {
        min-width: auto;
        max-width: none;
    }

    .wte-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .wte-pagination {
        justify-content: center;
        flex-wrap: wrap;
    }

    .wte-table-container {
        font-size: 12px;
    }

    .wte-th-content,
    .wte-td {
        padding: 8px 10px;
    }

    .wte-th-label {
        max-width: 120px;
    }

    .wte-td {
        max-width: 150px;
    }

    .wte-info-text {
        max-width: none;
        text-align: center;
    }

    /* Hide some pagination numbers on mobile */
    .wte-pagination-numbers .wte-page-number:not(.active) {
        display: none;
    }

    .wte-pagination-numbers .wte-page-number.active ~ .wte-page-number:nth-child(-n+2),
    .wte-pagination-numbers .wte-page-number.active ~ .wte-page-number:nth-last-child(-n+2) {
        display: inline-block;
    }

    /* Mobile language-specific button sizing */
    .wte-wrapper[data-lang="en"] .wte-pagination-btn {
        min-width: 70px;
    }
    
    .wte-wrapper[data-lang="de"] .wte-pagination-btn {
        min-width: 75px;
    }
    
    .wte-wrapper[data-lang="fr"] .wte-pagination-btn {
        min-width: 80px;
    }
    
    .wte-wrapper[data-lang="ru"] .wte-pagination-btn {
        min-width: 85px;
    }
}

@media (max-width: 480px) {
    .wte-th-label {
        font-size: 12px;
        max-width: 80px;
    }
    
    .wte-td {
        font-size: 12px;
        padding: 6px 8px;
        max-width: 100px;
    }

    .wte-pagination-btn,
    .wte-page-number {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
    }

    .wte-last-modified {
        padding: 6px 10px;
        font-size: 12px;
    }

    .wte-export-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 80px;
    }

    .wte-search {
        font-size: 12px;
        padding: 6px 30px 6px 10px;
    }

    /* Mobile language-specific sizing */
    .wte-wrapper[data-lang="en"] .wte-export-btn {
        min-width: 70px;
    }
    
    .wte-wrapper[data-lang="de"] .wte-export-btn {
        min-width: 90px;
    }
    
    .wte-wrapper[data-lang="fr"] .wte-export-btn {
        min-width: 80px;
    }
    
    .wte-wrapper[data-lang="ru"] .wte-export-btn {
        min-width: 85px;
    }
}

/* ========== LOADING STATE ========== */
.wte-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.wte-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4059b1;
    border-radius: 50%;
    animation: wte-spin 1s linear infinite;
    margin-left: 10px;
}

/* RTL support for loading spinner */
[dir="rtl"] .wte-loading::after {
    margin-left: 0;
    margin-right: 10px;
}

@keyframes wte-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== MODAL INTEGRATION ========== */
.warehouse-modal-content .wte-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.warehouse-modal-content .wte-table-container {
    flex: 1;
    border: none;
    border-radius: 0;
}

.warehouse-modal-content .wte-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    margin-left: -25px;
    margin-right: -25px;
    margin-bottom: -25px;
    padding-left: 25px;
    padding-right: 25px;
    padding-bottom: 20px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wte-table {
        border: 2px solid #000;
    }
    
    .wte-th,
    .wte-td {
        border-color: #000;
    }
    
    .wte-export-btn,
    .wte-pagination-btn,
    .wte-page-number {
        border: 2px solid #000;
    }
    
    .wte-export-btn {
        background: #000;
    }
    
    .wte-page-number.active {
        background: #000;
        border-color: #000;
    }
}

/* Reduce motion support */
@media (prefers-reduced-motion: reduce) {
    .wte-export-menu {
        transition: none;
    }
    
    .wte-th-content,
    .wte-row,
    .wte-pagination-btn,
    .wte-page-number {
        transition: none;
    }
    
    .wte-loading::after {
        animation: none;
    }
    
    .wte-notification {
        transition: none;
    }
}

/* Custom properties for dynamic language support */
:root {
  --wte-export-btn-width-en: 100px;
  --wte-export-btn-width-de: 120px;
  --wte-export-btn-width-fr: 110px;
  --wte-export-btn-width-ru: 115px;
  
  --wte-pagination-btn-width-en: 80px;
  --wte-pagination-btn-width-de: 90px;
  --wte-pagination-btn-width-fr: 95px;
  --wte-pagination-btn-width-ru: 100px;
}