/* Safari compatibility */
@supports (-webkit-appearance: none) {
    .user-table-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    .wp-user-table {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}/* Hide button text on small screens */
@media (max-width: 600px) {
    .edit-role-btn span,
    .delete-user-btn span {
        display: none;
    }

    .edit-role-btn,
    .delete-user-btn {
        padding: 0.5rem;
        width: 32px;
        height: 32px;
        justify-content: center;
    }

    .icon {
        margin: 0;
    }
}

/* Safari compatibility */
@supports (-webkit-appearance: none) {
    .user-table-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    .wp-user-table {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}.wp-user-table td:nth-child(2) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    padding-right: 1.5rem;
}/**
 * wp-user-manager.css
 * สไตล์ชีทปรับปรุงด้วยชุดสีน้ำเงิน-ส้ม-ดำ แบบโมเดิร์น
 */
 :root {
    /* ชุดสีหลัก */
    --primary-blue: #2563eb;
    --primary-blue-dark: #1d4ed8;
    --primary-blue-light: #60a5fa;
    --primary-blue-lighter: #dbeafe;

    --accent-orange: #f97316;
    --accent-orange-dark: #ea580c;
    --accent-orange-light: #fdba74;
    --accent-orange-lighter: #ffedd5;

    /* สีพื้นฐาน */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-white: #ffffff;

    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-gray: #f3f4f6;

    --border-light: #e5e7eb;
    --border-medium: #d1d5db;

    /* สีสำหรับไฮไลท์ user ใหม่ */
    --new-user-bg: #fef3c7;
    --new-user-border: #fbbf24;

    /* เอฟเฟกต์ */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* ขอบ */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* อีเวนต์ */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
}

/* Reset และ Base Styles */
.wp-user-manager-container-hjk789 *,
.wp-user-manager-container-hjk789 *::before,
.wp-user-manager-container-hjk789 *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.wp-user-manager-container-hjk789 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
    width: 100%;
}

/* ============ HEADER SECTION ============ */
.user-table-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.user-table-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    position: relative;
    padding-left: 1rem;
}

.user-table-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25rem;
    height: 1.25rem;
    width: 4px;
    background-color: var(--accent-orange);
    border-radius: var(--radius-sm);
}

.table-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
}

#user-search-input {
    padding: 0.625rem 0.75rem 0.625rem 2.25rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    width: 250px;
    transition: var(--transition);
    background-color: var(--bg-white);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

#user-search-input:focus {
    outline: none;
    border-color: var(--primary-blue-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#user-search-input::placeholder {
    color: var(--text-muted);
}

/* Role Filter และ Sort Controls */
#role-filter,
.sort-select-hjk789,
.sort-order-hjk789 {
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    background-color: var(--bg-white);
    transition: var(--transition);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1.25rem;
}

#role-filter:focus,
.sort-select-hjk789:focus,
.sort-order-hjk789:focus {
    outline: none;
    border-color: var(--primary-blue-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sort-order-hjk789 {
    width: 80px;
}

/* ============ TABLE STYLES ============ */
.user-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) var(--bg-light);
}

.user-table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.user-table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.user-table-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--border-medium);
    border-radius: 20px;
}

.user-table-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

.wp-user-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.wp-user-table th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.wp-user-table th:first-child {
    padding-left: 1.5rem;
    width: 32%;
}

.wp-user-table th:nth-child(2) {
    width: 24%;
}

.wp-user-table th:nth-child(3) {
    width: 22%;
}

.wp-user-table th:last-child {
    text-align: right;
    padding-right: 1.5rem;
    width: 22%;
}

/* Alignment สำหรับ username column */
.username-header-hjk789 {
    text-align: right !important;
    padding-right: 1rem !important;
}

.wp-user-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.wp-user-table td:first-child {
    padding-left: 1.5rem;
    padding-right: 1rem;
}

.wp-user-table tr.new-user-hjk789 td:first-child {
    padding-left: calc(1.5rem + 4px);
}

.wp-user-table td:nth-child(2) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

.wp-user-table td:last-child {
    text-align: right;
    padding-right: 1.5rem;
}

.wp-user-table tr:last-child td {
    border-bottom: none;
}

.wp-user-table tr {
    transition: var(--transition);
}

.wp-user-table tr:hover {
    background-color: var(--primary-blue-lighter);
}

/* Highlight สำหรับ user ใหม่ */
.wp-user-table tr.new-user-hjk789 {
    background-color: var(--new-user-bg);
    position: relative;
    transition: background-color 0.3s ease;
}

.wp-user-table tr.new-user-hjk789 td:first-child {
    position: relative;
}

.wp-user-table tr.new-user-hjk789 td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--new-user-border);
}

.wp-user-table tr.new-user-hjk789:hover {
    background-color: #fde68a;
}

.new-user-badge-hjk789 {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    background-color: var(--accent-orange);
    color: white;
    border-radius: var(--radius-2xl);
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* User Info Cells - ปรับให้ชิดขวา */
.username-cell-hjk789 {
    text-align: right !important;
    max-width: 280px;
    position: relative;
}

.user-info {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-direction: row-reverse; /* ทำให้ avatar อยู่ขวา */
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
}

.avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
    position: relative;
    overflow: hidden;
}

.avatar::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.initial {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* ทำให้ text ชิดขวา */
    min-width: 0; /* สำคัญสำหรับ text truncation */
    flex: 1;
}

.username {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    width: 100%;
}

.username-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    width: 100%;
    text-align: right;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    background-color: var(--primary-blue-lighter);
    color: var(--primary-blue-dark);
    border-radius: var(--radius-2xl);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
    white-space: nowrap;
}

/* Action Buttons */
.actions-cell {
    white-space: nowrap;
    display: flex;
    justify-content: flex-end;
    gap: 0.375rem;
}

.edit-role-btn,
.delete-user-btn {
    padding: 0.375rem 0.625rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.edit-role-btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.edit-role-btn:hover {
    background: linear-gradient(135deg, var(--primary-blue-dark) 0%, var(--primary-blue-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.3);
}

.delete-user-btn {
    background-color: white;
    border: 1px solid #fecaca;
    color: #ef4444;
}

.delete-user-btn:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ============ LOADING STATES ============ */
.loading-row {
    height: 200px;
}

.loading-cell {
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-blue-lighter);
    border-radius: 50%;
    border-top: 3px solid var(--primary-blue);
    animation: spin 1s linear infinite;
}

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

.empty-message {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.empty-message::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
}

/* ============ PAGINATION ============ */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-container.hidden {
    display: none;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.pagination-button {
    padding: 0.5rem 0.875rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.pagination-button:not(:disabled):hover {
    background-color: var(--bg-light);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.pagination-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.arrow {
    font-size: 0.75rem;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-number {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background-color: var(--bg-white);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.page-number:hover {
    background-color: var(--bg-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.page-number.active {
    background-color: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

/* ============ MODAL STYLES ============ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

body.modal-open {
    overflow: hidden;
}

.modal-content {
    background-color: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: modal-appear 0.3s ease;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-light);
}

.close-modal:hover {
    color: var(--text-primary);
    background-color: var(--bg-gray);
}

.modal h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.375rem;
    font-weight: 700;
}

.modal p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

#edit-user-info {
    padding: 0.75rem 1rem;
    background-color: var(--bg-light);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border-left: 3px solid var(--primary-blue);
}

#delete-user-info {
    padding: 0.75rem 1rem;
    background-color: #fee2e2;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    border-left: 3px solid #ef4444;
    color: #b91c1c;
}

.role-options {
    display: grid;
    gap: 0.625rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

.role-options::-webkit-scrollbar {
    width: 6px;
}

.role-options::-webkit-scrollbar-track {
    background: transparent;
}

.role-options::-webkit-scrollbar-thumb {
    background-color: var(--border-medium);
    border-radius: 20px;
}

.role-option {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.role-option:hover {
    border-color: var(--primary-blue-light);
    background-color: var(--primary-blue-lighter);
}

.role-option.selected {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue-lighter);
}

.role-option.selected::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.cancel-button,
.save-button,
.delete-button {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.cancel-button {
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.cancel-button:hover {
    background-color: var(--bg-gray);
    border-color: var(--border-medium);
}

.save-button {
    background-color: var(--primary-blue);
    border: none;
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.save-button:hover {
    background-color: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.3);
}

.delete-button {
    background-color: #ef4444;
    border: none;
    color: white;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.2);
}

.delete-button:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(239, 68, 68, 0.3);
}

/* Notification System */
.notification {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 2000;
    max-width: 400px;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid var(--accent-orange);
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.warning {
    border-left: 4px solid #f59e0b;
}

.notification-message {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.notification-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.125rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.notification-close:hover {
    color: var(--text-primary);
    background-color: var(--bg-gray);
}

/* ============ RESPONSIVE STYLES ============ */
@media (max-width: 1024px) {
    .wp-user-table th:first-child,
    .wp-user-table td:first-child {
        width: auto;
    }

    .username-text,
    .email {
        max-width: 150px;
    }
}

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

    .table-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    #user-search-input,
    #role-filter,
    .sort-select-hjk789,
    .sort-order-hjk789 {
        width: 100%;
    }

    .actions-cell {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-end;
    }

    .edit-role-btn,
    .delete-user-btn {
        width: auto;
        justify-content: center;
    }

    .pagination-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .pagination-controls {
        width: 100%;
        justify-content: space-between;
    }

    /* ปรับ alignment สำหรับ mobile */
    .user-info {
        flex-direction: row;
        justify-content: flex-start;
    }

    .user-details {
        align-items: flex-start;
    }

    .username,
    .email {
        text-align: left;
        justify-content: flex-start;
    }

    .username-cell-hjk789 {
        text-align: left !important;
    }

    .username-header-hjk789 {
        text-align: left !important;
        padding-left: 1.5rem !important;
    }

    .wp-user-table {
        table-layout: auto;
    }

    .wp-user-table th,
    .wp-user-table td {
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    .page-numbers {
        display: none;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
        margin-bottom: 0.75rem;
    }

    .pagination-controls {
        justify-content: space-between;
    }

    .wp-user-table th,
    .wp-user-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }

    .wp-user-table th:first-child,
    .wp-user-table td:first-child {
        padding-left: 0.75rem;
    }

    .wp-user-table tr.new-user-hjk789 td:first-child {
        padding-left: calc(0.75rem + 4px);
    }

    .wp-user-table th:last-child,
    .wp-user-table td:last-child {
        padding-right: 0.75rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .edit-role-btn,
    .delete-user-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .icon {
        width: 12px;
        height: 12px;
    }

    .avatar {
        width: 32px;
        height: 32px;
    }

    .initial {
        font-size: 0.8rem;
    }

    .username-text,
    .email {
        max-width: 120px;
        font-size: 0.75rem;
    }

    .new-user-badge-hjk789 {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }
}

/* ============ ACCENT STYLES & ANIMATION ============ */
/* เพิ่มความน่าสนใจด้วยสีส้มเป็น accent color */
.user-table-wrapper {
    position: relative;
}

.user-table-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--accent-orange) 100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ปุ่มแอ็คชั่นรูปแบบใหม่ */
.edit-role-btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
}

.delete-user-btn {
    background-color: white;
    border: 1px solid #fecaca;
    color: #ef4444;
}

.delete-user-btn:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

/* ใช้สีส้มเป็น accent สำหรับการเลือก role */
.role-option.selected {
    border-color: var(--accent-orange);
}

.role-option.selected::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23f97316'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'%3E%3C/path%3E%3C/svg%3E");
}

/* ปรับแต่ง hover effect ให้มีความน่าสนใจยิ่งขึ้น */
.page-number:hover,
.pagination-button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
}

.save-button {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
}

/* Animation สำหรับบางองค์ประกอบ */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.notification.show {
    animation: pulse 0.3s ease-in-out forwards;
}

/* Animation สำหรับ new user highlight */
@keyframes newUserGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

.wp-user-table tr.new-user-hjk789 {
    animation: newUserGlow 3s ease-in-out infinite;
}

/* Hide button text on small screens */
@media (max-width: 600px) {
    .edit-role-btn span,
    .delete-user-btn span {
        display: none;
    }

    .edit-role-btn,
    .delete-user-btn {
        padding: 0.375rem;
    }
}

/* ============================================================
 * DGA Horizontal Layout Styles (from dga-horizontal.css)
 * ============================================================ */

/**
 * DGA User Creation System - Horizontal Layout CSS
 * Version: 1.0.0
 * Optimized for space-saving horizontal layouts
 */

/* Root variables */
:root {
    --dga-primary: #667eea;
    --dga-primary-dark: #5a67d8;
    --dga-secondary: #764ba2;
    --dga-success: #10b981;
    --dga-error: #ef4444;
    --dga-warning: #f59e0b;
    --dga-info: #3b82f6;
    --dga-gray-50: #f9fafb;
    --dga-gray-100: #f3f4f6;
    --dga-gray-200: #e5e7eb;
    --dga-gray-300: #d1d5db;
    --dga-gray-400: #9ca3af;
    --dga-gray-500: #6b7280;
    --dga-gray-600: #4b5563;
    --dga-gray-700: #374151;
    --dga-gray-800: #1f2937;
    --dga-gray-900: #111827;
}

/* Reset box sizing */
.dga-user-system-hjk456 *,
.dga-user-system-hjk456 *::before,
.dga-user-system-hjk456 *::after {
    box-sizing: border-box;
}

/* Main container */
.dga-user-system-hjk456 {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Notifications */
#dga-notifications-hjk456 {
    margin-bottom: 1rem;
}

.dga-notification-hjk456 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    animation: dga-slide-down 0.3s ease-out;
}

@keyframes dga-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dga-notification-hjk456 .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

.dga-notification-success-hjk456 {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.dga-notification-error-hjk456 {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.dga-notification-warning-hjk456 {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Alert styles */
.dga-alert-hjk456 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 6px;
    background-color: var(--dga-gray-100);
    color: var(--dga-gray-700);
}

.dga-alert-error-hjk456 {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--dga-error);
}

/* Horizontal form container */
.dga-form-horizontal-hjk456 {
    background: white;
    border: 1px solid var(--dga-gray-200);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Flex form layout */
.dga-flex-form-hjk456 {
    display: flex;
    align-items: stretch;
    min-height: 60px;
}

.dga-form-fields-hjk456 {
    display: flex;
    flex: 1;
    align-items: center;
    padding: 0.75rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Field groups */
.dga-field-group-hjk456 {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.dga-field-group-hjk456:first-child {
    flex: 2;
    min-width: 250px;
}

/* Input and select styles */
.dga-input-hjk456,
.dga-select-hjk456 {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 2.5rem;
    border: 2px solid var(--dga-gray-200);
    border-radius: 6px;
    font-size: 0.875rem;
    background-color: white;
    transition: all 0.2s ease;
    appearance: none;
}

.dga-input-hjk456:focus,
.dga-select-hjk456:focus {
    outline: none;
    border-color: var(--dga-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dga-input-hjk456.error {
    border-color: var(--dga-error);
    background-color: #fef2f2;
}

.dga-input-hjk456::placeholder {
    color: var(--dga-gray-400);
}

/* Field icons */
.dga-field-icon-hjk456 {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dga-gray-400);
    pointer-events: none;
}

.dga-field-icon-hjk456 .dashicons {
    font-size: 1.125rem;
    width: 1.125rem;
    height: 1.125rem;
}

/* Field status indicator */
.dga-field-status-hjk456 {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.125rem;
    height: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.dga-field-status-hjk456.valid {
    color: var(--dga-success);
}

.dga-field-status-hjk456.invalid {
    color: var(--dga-error);
}

/* Select dropdown arrow */
.dga-select-hjk456 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M5.3 8.7L1.1 4.5c-.4-.4-.4-1 0-1.4s1-.4 1.4 0L6 6.6l3.5-3.5c.4-.4 1-.4 1.4 0s.4 1 0 1.4L6.7 8.7c-.4.4-1 .4-1.4 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Submit button */
.dga-btn-submit-hjk456 {
    position: relative;
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, var(--dga-primary) 0%, var(--dga-secondary) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 120px;
}

.dga-btn-submit-hjk456:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.dga-btn-submit-hjk456:active {
    transform: translateY(0);
}

.dga-btn-submit-hjk456:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Button loading state */
.dga-btn-submit-hjk456.loading .dga-btn-text-hjk456 {
    visibility: hidden;
}

.dga-btn-loading-hjk456 {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: dga-spin 0.8s linear infinite;
}

.dga-btn-submit-hjk456.loading .dga-btn-loading-hjk456 {
    display: block;
}

@keyframes dga-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Form hint */
.dga-form-hint-hjk456 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--dga-gray-50);
    border-top: 1px solid var(--dga-gray-200);
    font-size: 0.8125rem;
    color: var(--dga-gray-600);
}

.dga-form-hint-hjk456 .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
    color: var(--dga-info);
    flex-shrink: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .dga-flex-form-hjk456 {
        flex-direction: column;
        min-height: auto;
    }

    .dga-form-fields-hjk456 {
        flex-direction: column;
        padding: 1rem;
    }

    .dga-field-group-hjk456,
    .dga-field-group-hjk456:first-child {
        width: 100%;
        min-width: unset;
    }

    .dga-btn-submit-hjk456 {
        width: 100%;
        padding: 0.75rem;
    }

    .dga-form-hint-hjk456 {
        padding: 1rem;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .dga-user-system-hjk456 {
        padding: 0 0.5rem;
    }

    .dga-input-hjk456,
    .dga-select-hjk456 {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Tablet optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .dga-form-fields-hjk456 {
        padding: 1rem;
    }

    .dga-field-group-hjk456:first-child {
        flex: 1.5;
    }
}

/* Print styles */
@media print {
    .dga-user-system-hjk456 {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .dga-input-hjk456,
    .dga-select-hjk456 {
        border-width: 3px;
    }

    .dga-btn-submit-hjk456 {
        background: var(--dga-primary);
        border: 2px solid white;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* WordPress admin bar compatibility */
body.admin-bar .dga-user-system-hjk456 {
    margin-top: 32px;
}

@media (max-width: 782px) {
    body.admin-bar .dga-user-system-hjk456 {
        margin-top: 46px;
    }
}

/* Focus visible for accessibility */
.dga-input-hjk456:focus-visible,
.dga-select-hjk456:focus-visible,
.dga-btn-submit-hjk456:focus-visible {
    outline: 3px solid var(--dga-primary);
    outline-offset: 2px;
}

/* Loading overlay */
.dga-user-system-hjk456.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Compact mode for embedding */
.dga-user-system-hjk456.compact .dga-form-horizontal-hjk456 {
    border: none;
    box-shadow: none;
    background: transparent;
}

.dga-user-system-hjk456.compact .dga-form-fields-hjk456 {
    padding: 0.5rem;
    gap: 0.5rem;
}

.dga-user-system-hjk456.compact .dga-input-hjk456,
.dga-user-system-hjk456.compact .dga-select-hjk456 {
    padding: 0.5rem 2rem;
    font-size: 0.8125rem;
}

.dga-user-system-hjk456.compact .dga-btn-submit-hjk456 {
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
}

.dga-user-system-hjk456.compact .dga-form-hint-hjk456 {
    display: none;
}


/* Clear button styles */
.dga-clear-btn-hjk456 {
    position: absolute;
    right: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--dga-gray-400);
    display: none;
    transition: all 0.2s ease;
    z-index: 2;
}

.dga-clear-btn-hjk456:hover {
    color: var(--dga-gray-600);
    background-color: var(--dga-gray-100);
    border-radius: 4px;
}

.dga-clear-btn-hjk456 .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}

/* Show clear button when input has value */
.dga-field-group-hjk456.has-value .dga-clear-btn-hjk456 {
    display: block;
}

/* Adjust input padding when clear button is visible */
.dga-field-group-hjk456.has-value .dga-input-hjk456 {
    padding-right: 4.5rem;
}

/* Modal styles */
.dga-modal-hjk456 {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: dga-fade-in 0.3s ease;
}

.dga-modal-hjk456.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes dga-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.dga-modal-content-hjk456 {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    animation: dga-slide-up 0.3s ease;
}

@keyframes dga-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal header */
.dga-modal-header-hjk456 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--dga-primary) 0%, var(--dga-secondary) 100%);
    color: white;
}

.dga-modal-header-hjk456 h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.dga-modal-close-hjk456 {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    transition: opacity 0.2s ease;
}

.dga-modal-close-hjk456:hover {
    opacity: 0.8;
}

.dga-modal-close-hjk456 .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

/* Modal body */
.dga-modal-body-hjk456 {
    padding: 1.5rem;
}

.dga-confirm-info-hjk456 {
    background-color: var(--dga-gray-50);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.dga-confirm-item-hjk456 {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.dga-confirm-item-hjk456:not(:last-child) {
    border-bottom: 1px solid var(--dga-gray-200);
}

.dga-confirm-label-hjk456 {
    font-weight: 600;
    color: var(--dga-gray-600);
    width: 100px;
    font-size: 0.875rem;
}

.dga-confirm-value-hjk456 {
    flex: 1;
    color: var(--dga-gray-800);
    font-size: 0.9375rem;
}

.dga-modal-notice-hjk456 {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background-color: #e0f2fe;
    border-left: 4px solid var(--dga-info);
    padding: 1rem;
    border-radius: 4px;
}

.dga-modal-notice-hjk456 .dashicons {
    color: var(--dga-info);
    font-size: 1.125rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.dga-modal-notice-hjk456 p {
    margin: 0;
    color: var(--dga-gray-700);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Modal footer */
.dga-modal-footer-hjk456 {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background-color: var(--dga-gray-50);
    border-top: 1px solid var(--dga-gray-200);
}

.dga-modal-cancel-hjk456,
.dga-modal-confirm-hjk456 {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    position: relative;
}

.dga-modal-cancel-hjk456 {
    background-color: white;
    color: var(--dga-gray-700);
    border: 2px solid var(--dga-gray-300);
}

.dga-modal-cancel-hjk456:hover {
    background-color: var(--dga-gray-50);
    border-color: var(--dga-gray-400);
}

.dga-modal-confirm-hjk456 {
    background: linear-gradient(135deg, var(--dga-primary) 0%, var(--dga-secondary) 100%);
    color: white;
    min-width: 120px;
}

.dga-modal-confirm-hjk456:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.dga-modal-confirm-hjk456:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Modal loading state */
.dga-modal-confirm-hjk456.loading .dga-modal-confirm-text-hjk456 {
    visibility: hidden;
}

.dga-modal-confirm-loading-hjk456 {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: dga-spin 0.8s linear infinite;
}

.dga-modal-confirm-hjk456.loading .dga-modal-confirm-loading-hjk456 {
    display: block;
}

/* Responsive modal */
@media (max-width: 480px) {
    .dga-modal-content-hjk456 {
        width: 95%;
        margin: 1rem;
    }

    .dga-modal-header-hjk456,
    .dga-modal-body-hjk456 {
        padding: 1rem;
    }

    .dga-confirm-label-hjk456 {
        width: 80px;
    }

    .dga-modal-footer-hjk456 {
        flex-direction: column-reverse;
        gap: 0.5rem;
        padding: 1rem;
    }

    .dga-modal-cancel-hjk456,
    .dga-modal-confirm-hjk456 {
        width: 100%;
    }
}

/* Focus trap styles */
.dga-modal-hjk456.active .dga-modal-content-hjk456 {
    outline: none;
}

.dga-modal-hjk456.active button:focus,
.dga-modal-hjk456.active input:focus,
.dga-modal-hjk456.active select:focus {
    outline: 3px solid var(--dga-primary);
    outline-offset: 2px;
}

/* Prevent body scroll when modal is open */
body.dga-modal-open-hjk456 {
    overflow: hidden;
    position: fixed;
    width: 100%;
}