/**
 * TABELE UNIFICATE - Stil consistent pentru toate tabelele din sistem
 * Bazat pe stilurile .ai-table din dashboard
 * Verde gradient identity: linear-gradient(234deg, #31884D 29%, #102526 100%)
 */

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.table-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 15px;
}

.title-with-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d5f4f;
    margin: 0;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   STILURI TABEL PRINCIPALE
   ======================================== */

/* Toate clasele de tabel vor folosi aceleași stiluri */
.nomenclator-table,
.clients-table,
.patients-table,
.users-table,
.contract-table,
.ai-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 0.9rem !important;
    background: white !important;
}

/* THEAD - Header consistent pentru toate tabelele */
.nomenclator-table thead,
.clients-table thead,
.patients-table thead,
.users-table thead,
.contract-table thead,
.ai-table thead {
    background-image: linear-gradient(234deg, #31884D 29%, #102526 100%) !important;
    background: linear-gradient(234deg, #31884D 29%, #102526 100%) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
}

/* TH - Celule header */
.nomenclator-table th,
.clients-table th,
.patients-table th,
.users-table th,
.contract-table th,
.ai-table th {
    color: white !important;
    font-weight: 600 !important;
    padding: 15px 12px !important;
    text-align: left !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-size: 0.9rem !important;
    background: transparent !important;
}

.nomenclator-table th:hover,
.clients-table th:hover,
.patients-table th:hover,
.users-table th:hover,
.contract-table th:hover,
.ai-table th:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* TH sortable cu săgeți */
.nomenclator-table th.sortable,
.clients-table th.sortable,
.patients-table th.sortable,
.users-table th.sortable,
.contract-table th.sortable,
.ai-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Săgeți sort */
.sort-arrows {
    display: inline-block;
    margin-left: 5px;
    font-size: 10px;
    opacity: 0.5;
}

.sort-up, .sort-down {
    display: block;
    line-height: 0.6;
}

/* TBODY - Rânduri */
.nomenclator-table tbody tr,
.clients-table tbody tr,
.patients-table tbody tr,
.users-table tbody tr,
.contract-table tbody tr,
.ai-table tbody tr {
    border-bottom: 1px solid #f1f3f4 !important;
    transition: all 0.3s ease !important;
}

.nomenclator-table tbody tr:hover,
.clients-table tbody tr:hover,
.patients-table tbody tr:hover,
.users-table tbody tr:hover,
.contract-table tbody tr:hover,
.ai-table tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* TD - Celule date */
.nomenclator-table td,
.clients-table td,
.patients-table td,
.users-table td,
.contract-table td,
.ai-table td {
    padding: 12px !important;
    color: #495057 !important;
    vertical-align: top !important;
    font-size: 0.9rem !important;
    border: none !important;
}

/* ========================================
   BUTOANE & CONTROALE
   ======================================== */

.toggle-btn,
.toggle-table-btn {
    background: #2d5f4f;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover,
.toggle-table-btn:hover {
    background: #1e4a3a;
    transform: scale(1.1);
}

.btn-add-client,
.btn-add {
    background: #28a745;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-add-client:hover,
.btn-add:hover {
    background: #218838;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    min-width: 200px;
    transition: all 0.2s ease;
    color: #374151;
}

.search-input:focus {
    border-color: #2d5f4f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 95, 79, 0.1);
}

.search-input::placeholder {
    color: #9ca3af;
}

.export-btn {
    background: #2d5f4f;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.export-btn:hover {
    background: #1e4a3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.export-btn svg {
    width: 16px;
    height: 16px;
}

/* ========================================
   BUTOANE ACȚIUNI
   ======================================== */

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-edit,
.btn-delete,
.btn-view {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #ffc107;
    color: #000;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-view {
    background: #17a2b8;
    color: white;
}

.btn-view:hover {
    background: #138496;
}

/* ========================================
   FILTRU SELECT
   ======================================== */

.filter-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    border-color: #2d5f4f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 95, 79, 0.1);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .search-input {
        width: 100%;
        min-width: 100%;
    }

    .nomenclator-table th,
    .clients-table th,
    .patients-table th,
    .users-table th,
    .contract-table th,
    .ai-table th,
    .nomenclator-table td,
    .clients-table td,
    .patients-table td,
    .users-table td,
    .contract-table td,
    .ai-table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    .table-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .nomenclator-table th,
    .clients-table th,
    .patients-table th,
    .users-table th,
    .contract-table th,
    .ai-table th,
    .nomenclator-table td,
    .clients-table td,
    .patients-table td,
    .users-table td,
    .contract-table td,
    .ai-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .btn-add-client,
    .btn-add {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

/* ========================================
   CLASE HELPER
   ======================================== */

.actions-column {
    text-align: center;
    width: 120px;
}

.table-row {
    cursor: pointer;
}

.table-row.selected {
    background-color: #e7f5ff;
}

/* Verde pentru status active/online */
.status-active,
.status-online {
    color: #28a745;
    font-weight: 600;
}

/* Galben pentru status warning */
.status-warning {
    color: #ffc107;
    font-weight: 600;
}

/* Roșu pentru status inactive/offline */
.status-inactive,
.status-offline {
    color: #dc3545;
    font-weight: 600;
}

/* Gri pentru status neutral */
.status-neutral {
    color: #6c757d;
}

/* ========================================
   OBSERVAȚII
   ======================================== */

.observatii-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.observatii-cell:hover {
    overflow: visible;
    white-space: normal;
    background: #fff;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
