/* Inherit website font */
.dm-modern-table-container,
.dm-modern-table-container *,
.dm-modern-styled-table,
.dm-modern-styled-table * {
    font-family: inherit;
}

/* Modern Directory Table Styles */

.dm-modern-table {
    max-width: 100%;
    margin: 40px auto;
    padding: 20px;
}

/* Controls Header */
.dm-modern-controls {
    background: #fff;
    padding: 20px 28px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-bottom: 2px solid #f0f0f0;
}

.dm-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dm-table-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dm-controls-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Entries Per Page Control */
.dm-entries-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}

.dm-entries-select {
    padding: 0px 32px 0px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23666' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
}

.dm-entries-select:hover {
    border-color: #cbd5e0;
}

.dm-entries-select:focus {
    outline: none;
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Modern Search */
.dm-modern-search {
    display: flex;
    gap: 12px;
    align-items: center;
}

.dm-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.dm-search-icon {
    position: absolute;
    left: 16px;
    color: #a0aec0;
    pointer-events: none;
}

.dm-modern-search-input {
    flex: 1;
    height: 48px;
    padding: 0 44px 0 48px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    color: #2d3748;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    appearance: none;
    -webkit-appearance: none;
}

/* Hide default clear button in search input (Chrome/Safari) */
.dm-modern-search-input::-webkit-search-decoration,
.dm-modern-search-input::-webkit-search-cancel-button,
.dm-modern-search-input::-webkit-search-results-button,
.dm-modern-search-input::-webkit-search-results-decoration {
    display: none;
}

.dm-modern-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #667eea);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.08);
}

.dm-modern-search-input::placeholder {
    color: #a0aec0;
}

.dm-clear-btn {
    position: absolute;
    right: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: #e2e8f0;
    color: #718096;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dm-clear-btn:hover {
    background: #cbd5e0;
    color: #2d3748;
}

.dm-modern-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--primary-color, #667eea);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.dm-modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.dm-modern-btn svg {
    width: 18px;
    height: 18px;
}

/* Results Info */
.dm-modern-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
    background: #f7fafc;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.dm-info-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dm-total-count {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    padding: 6px 14px;
    background: #fff;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.dm-view-options {
    display: flex;
    gap: 8px;
}

.dm-view-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #718096;
}

.dm-view-btn:hover {
    border-color: var(--primary-color, #667eea);
    color: var(--primary-color, #667eea);
}

.dm-view-btn.active {
    background: var(--primary-color, #667eea);
    border-color: var(--primary-color, #667eea);
    color: #fff;
}

/* Table Container with Scroll */
.dm-modern-table-container {
    background: #fff;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    border: 1px solid #e2e8f0;
    border-top: none;
}

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

/* Custom Scrollbar */
.dm-table-scroll-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.dm-table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.dm-table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.dm-table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Modern Styled Table */
.dm-modern-styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.dm-modern-styled-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.dm-modern-styled-table th {
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.dm-modern-styled-table tbody tr {
    transition: all 0.2s ease;
}

.dm-modern-styled-table td {
    color: var(--text-color, #4a5568);
}

.dm-modern-styled-table td img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Loading State */
.dm-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.dm-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color, #667eea);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

.dm-loading p {
    margin-top: 16px;
    color: #4a5568;
    font-weight: 500;
}

/* No Results */
.dm-no-results {
    padding: 80px 40px;
    text-align: center;
}

.dm-no-results-icon {
    color: #cbd5e0;
    margin-bottom: 24px;
}

.dm-no-results h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 8px 0;
}

.dm-no-results p {
    font-size: 15px;
    color: #718096;
    margin: 0;
}

/* Modern Pagination */
.dm-modern-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    background: #fff;
    border-radius: 16px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.dm-pagination-info {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

.dm-pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dm-modern-pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #4a5568;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-modern-pagination button:hover:not(:disabled) {
    border-color: var(--primary-color, #667eea);
    color: var(--primary-color, #667eea);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.dm-modern-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.dm-modern-pagination button.active {
    background: var(--primary-color, #667eea);
    color: #fff;
    border-color: var(--primary-color, #667eea);
}

.dm-pagination-ellipsis {
    color: #a0aec0;
    padding: 0 8px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dm-table-scroll-wrapper {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .dm-modern-table {
        padding: 10px;
    }
    
    .dm-modern-controls {
        padding: 20px;
        border-radius: 12px 12px 0 0;
    }
    
    .dm-controls-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .dm-modern-search {
        flex-direction: column;
        width: 100%;
    }
    
    .dm-search-input-wrapper {
        width: 100%;
        margin: 0;
    }
    
    #dm-search-form {
        margin: 0;
        width: 100%;
    }
    
    .dm-modern-btn {
        width: 100%;
        justify-content: center;
    }
    
    .dm-modern-info {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .dm-modern-pagination {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .dm-pagination-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .dm-table-scroll-wrapper {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .dm-table-title {
        font-size: 18px;
    }
    
    .dm-modern-controls {
        padding: 16px;
    }
    
    .dm-modern-styled-table {
        min-width: 600px;
    }
    
    .dm-pagination-buttons button {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .dm-modern-controls,
    .dm-modern-info,
    .dm-modern-pagination {
        display: none;
    }
    
    .dm-table-scroll-wrapper {
        overflow: visible;
        max-height: none;
    }
    
    .dm-modern-table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Profile Image Styles */
.dm-modern-styled-table td img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    display: block;
    margin: 0 auto;
}
/* ── Sortable Column Headers ── */
.dm-sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
    position: relative;
    padding-right: 22px !important;
}
.dm-sortable-th:hover {
    background: rgba(255,255,255,0.15) !important;
}
/* Default: stacked up+down arrows (inactive) */
.dm-sortable-th::before,
.dm-sortable-th::after {
    content: '';
    position: absolute;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.35;
}
.dm-sortable-th::before {
    top: calc(50% - 7px);
    border-bottom: 5px solid currentColor;
}
.dm-sortable-th::after {
    top: calc(50% + 2px);
    border-top: 5px solid currentColor;
}
/* ASC active — only up arrow lit */
.dm-sortable-th.dm-sort-asc::before {
    opacity: 1;
}
.dm-sortable-th.dm-sort-asc::after {
    opacity: 0.2;
}
/* DESC active — only down arrow lit */
.dm-sortable-th.dm-sort-desc::before {
    opacity: 0.2;
}
.dm-sortable-th.dm-sort-desc::after {
    opacity: 1;
}