.admin-layout {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0e8 100%);
}

.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a365d 0%, #2c5282 100%);
    padding: 1.5rem 1.5rem 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
    border-right: 3px solid rgba(201, 169, 97, 0.3);
    display: flex;
    flex-direction: column;
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.admin-back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: white;
    border: 3px solid rgba(201, 169, 97, 0.5);
    cursor: pointer;
    color: #1a365d;
    transition: all 0.3s ease;
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-back-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
    background: #f5f0e8;
    border-color: #c9a961;
}

.admin-back-button svg {
    width: 24px;
    height: 24px;
}

.admin-logo {
    padding: 0;
    flex: 1;
}

.admin-logo h2 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.admin-logo h2 {
    color: white;
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.admin-badge {
    background: linear-gradient(135deg, #c9a961 0%, #d4b574 100%);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 0.9rem;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-md);
    cursor: pointer;
    /* Fix: transition spécifiques au lieu de 'all' pour éviter le flash */
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    position: relative;
    white-space: nowrap;
}

.admin-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #c9a961;
    border-radius: 2px;
    transition: height 0.3s ease;
}

.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    /* transform: translateX(6px);  Removed to prevent flickering */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.admin-nav-item:hover::before {
    height: 60%;
}

.admin-nav-item.active {
    background: rgba(255, 255, 255, 0.18);
    color: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.admin-nav-item.active::before {
    height: 70%;
}

.admin-nav-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.admin-content {
    margin-left: 260px;
    flex: 1;
    padding: 3rem 3rem 2rem 3rem;
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0e8 100%);
    overflow-y: auto;
    max-height: 100vh;
}

.roles-grid {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.2);
    position: relative;
}

.roles-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(201, 169, 97, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.roles-grid h2 {
    color: #1a365d;
    margin: 0 0 2rem 0;
    font-size: 1.5rem;
    font-family: var(--font-heading);
    position: relative;
}

.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.role-card {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0e8 100%);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(201, 169, 97, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06), 0 1px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    position: relative;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(201, 169, 97, 0.05) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.role-card:hover {
    /* transform: translateY(-8px); Removed to prevent flickering */
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 15px rgba(0, 0, 0, 0.06);
}

.role-card:hover::before {
    opacity: 1;
}

.role-badge {
    color: white;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

.role-count {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a365d;
    font-family: var(--font-heading);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 1;
}

.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 0.8rem 1.2rem;
    border: 2px solid #e8e4df;
    border-radius: var(--radius-md);
    background: white;
    color: #1a1a1a;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input::placeholder {
    color: #94a3b8;
}

.search-input:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 4px rgba(201, 169, 97, 0.1);
}

.role-filter,
.banned-filter {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e8e4df;
    border-radius: var(--radius-md);
    background: white;
    color: #1a1a1a;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.role-filter:focus,
.banned-filter:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
}

/* ========== ADMIN BUTTONS - High specificity overrides ========== */
/* Ces règles écrasent les styles de home.css et components.css */

.admin-layout .btn,
.modal .btn {
    padding: 0.625rem 1.125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    transform: none;
}

.admin-layout .btn:hover,
.modal .btn:hover {
    transform: none;
}

/* Primary - Bleu du thème harmonisé */
.admin-layout .btn-primary,
.modal .btn-primary {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(26, 54, 93, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-layout .btn-primary:hover,
.modal .btn-primary:hover {
    background: linear-gradient(135deg, #2c5282 0%, #2b6cb0 100%);
    box-shadow: 0 4px 16px rgba(26, 54, 93, 0.35);
    transform: translateY(-1px);
}

/* Secondary - Neutre élégant */
.admin-layout .btn-secondary,
.modal .btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    color: #1a365d;
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.admin-layout .btn-secondary:hover,
.modal .btn-secondary:hover {
    background: linear-gradient(135deg, #fafbfc 0%, #f5f0e8 100%);
    border-color: #c9a961;
    color: #1a365d;
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.15);
}

/* Published - Vert succès */
.admin-layout .btn-published,
.modal .btn-published {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #047857;
    border: 1.5px solid #6ee7b7;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.15);
}

.admin-layout .btn-published:hover,
.modal .btn-published:hover {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #34d399;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Unpublished - Gris clair */
.admin-layout .btn-unpublished,
.modal .btn-unpublished {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #4b5563;
    border: 1.5px solid #d1d5db;
    box-shadow: 0 2px 6px rgba(107, 114, 128, 0.15);
}

.admin-layout .btn-unpublished:hover,
.modal .btn-unpublished:hover {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    border-color: #9ca3af;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.25);
}

/* Premium - Jaune doré transparent */
.admin-layout .btn-premium,
.modal .btn-premium {
    background: linear-gradient(135deg, rgba(255, 248, 225, 0.7) 0%, rgba(255, 238, 153, 0.7) 100%);
    color: #b45309;
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.15);
}

.admin-layout .btn-premium:hover,
.modal .btn-premium:hover {
    background: linear-gradient(135deg, rgba(255, 238, 153, 0.8) 0%, rgba(255, 215, 0, 0.8) 100%);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.25);
}

/* Free - Bleu léger transparent */
.admin-layout .btn-free,
.modal .btn-free {
    background: linear-gradient(135deg, rgba(227, 242, 253, 0.7) 0%, rgba(179, 229, 252, 0.7) 100%);
    color: #1565c0;
    border: 1.5px solid rgba(144, 202, 249, 0.4);
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.15);
}

.admin-layout .btn-free:hover,
.modal .btn-free:hover {
    background: linear-gradient(135deg, rgba(179, 229, 252, 0.8) 0%, rgba(129, 212, 250, 0.8) 100%);
    border-color: rgba(144, 202, 249, 0.6);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.25);
}


/* Danger - Rouge suppression */
.admin-layout .btn-danger,
.modal .btn-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
    border: 1.5px solid #fca5a5;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

.admin-layout .btn-danger:hover,
.modal .btn-danger:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #f87171;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}



.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 0.5rem;
    border: 2px solid #e8e4df;
    background: white;
    color: #1a365d;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: #c9a961;
    background: #f5f0e8;
    transform: scale(1.05);
}

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

.btn-icon-subtle {
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-subtle:hover {
    color: #1a365d;
    background: rgba(26, 54, 93, 0.08);
}

.btn-icon-subtle svg {
    width: 14px;
    height: 14px;
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.admin-header-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header-left h1 {
    margin: 0;
}

.admin-tab {
    display: none;
}

.admin-tab.active {
    display: block;
}

.users-table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.2);
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.users-table thead {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
}

.users-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    cursor: col-resize;
    position: relative;
}

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

.users-table tbody tr {
    border-bottom: 1px solid #e8e4df;
    transition: background-color 0.2s ease;
}

.users-table tbody tr:hover {
    background-color: #f9fafb;
}

.users-table tbody tr:last-child {
    border-bottom: none;
}

.users-table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c9a961 0%, #d4b574 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.3);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.1) 100%);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.banned {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: #dc2626;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.status-badge.pending {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.user-banned {
    background-color: rgba(220, 38, 38, 0.03);
}

.user-banned td {
    color: #6b7280;
}

.action-buttons {
    display: flex;
    gap: 0.4rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.action-btn:hover {
    /* transform: translateY(-2px); Removed to prevent flickering */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.action-btn-edit:hover {
    color: #1a365d;
    border-color: #1a365d;
    background: rgba(26, 54, 93, 0.05);
}

.action-btn-ban:hover {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.action-btn-unban:hover {
    color: #059669;
    border-color: #059669;
    background: rgba(16, 185, 129, 0.05);
}

.action-btn-delete:hover {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.action-btn-up:hover:not(:disabled) {
    color: #1a365d;
    border-color: #c9a961;
    background: rgba(201, 169, 97, 0.1);
}

.action-btn-down:hover:not(:disabled) {
    color: #1a365d;
    border-color: #c9a961;
    background: rgba(201, 169, 97, 0.1);
}

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    border: 2px solid #e8e4df;
    background: white;
    color: #1a365d;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #c9a961;
    background: #f5f0e8;
}

.pagination-btn.active {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
    border-color: #1a365d;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.text-center {
    text-align: center;
}

.text-danger {
    color: #dc2626;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 54, 93, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

@media (max-width: 768px) {
    .modal {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0.5rem;
    }
}

.modal.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 20px;
    border: 1px solid rgba(201, 169, 97, 0.15);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.5),
        0 8px 32px rgba(26, 54, 93, 0.12),
        0 32px 80px rgba(26, 54, 93, 0.18),
        0 0 0 1px rgba(201, 169, 97, 0.1);
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

@media (max-height: 600px) {
    .modal-content {
        max-height: 95vh;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1a365d 0%, #c9a961 50%, #1a365d 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show .modal-content::before {
    opacity: 1;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem 1.25rem;
    background: linear-gradient(180deg, linear-gradient(135deg, rgba(26, 54, 93, 0.02) 0%, rgba(201, 169, 97, 0.03) 100%), #ffffff 100%);
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
    flex-shrink: 0;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(201, 169, 97, 0.3) 50%, transparent 100%);
}

.modal-header h2 {
    color: #1a365d;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-family: var(--font-heading);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(201, 169, 97, 0.2);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    cursor: pointer;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: -0.25rem;
}

.modal-close:hover {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    transform: rotate(90deg) scale(1.05);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    background: linear-gradient(135deg, rgba(250, 249, 247, 0.5) 0%, rgba(255, 255, 255, 0.8) 100%);
}

.modal-field {
    margin-bottom: 1.5rem;
}

.modal-field:last-of-type {
    margin-bottom: 0;
}

.modal-field label {
    display: block;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 0.625rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    padding-left: 0.5rem;
}

.modal-field label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #c9a961 0%, #d4b574 100%);
    border-radius: 2px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    border-radius: 10px;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.modal-field input:hover,
.modal-field select:hover,
.modal-field textarea:hover {
    border-color: rgba(201, 169, 97, 0.4);
    background: #fafafa;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
    outline: none;
    border-color: #c9a961;
    background: #ffffff;
    box-shadow:
        0 0 0 4px rgba(201, 169, 97, 0.1),
        inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.modal-field input::placeholder,
.modal-field textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.modal-field small {
    display: block;
    margin-top: 0.625rem;
    color: #6b7280;
    font-size: 0.8rem;
    line-height: 1.5;
    padding-left: 0.5rem;
}

.modal-note {
    background: linear-gradient(135deg, rgba(26, 54, 93, 0.04) 0%, rgba(201, 169, 97, 0.04) 100%);
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    border-left: 4px solid #c9a961;
    border-radius: 10px;
    padding: 1rem 1.125rem;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    color: #1a365d;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(201, 169, 97, 0.08);
}

.modal-note strong {
    color: #1a365d;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 0.875rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, #ffffff 0%, linear-gradient(135deg, rgba(250, 249, 247, 0.5) 0%, rgba(201, 169, 97, 0.05) 100%) 100%);
    border-top: 1px solid rgba(201, 169, 97, 0.2);
    flex-shrink: 0;
    position: relative;
}

.modal-actions::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(201, 169, 97, 0.3) 50%, transparent 100%);
}

.ban-info {
    background: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.ban-info p {
    margin: 0.4rem 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.ban-info strong {
    color: #dc2626;
}

.video-tree-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.2);
    padding: 1.5rem;
    min-height: 600px;
}

.video-tree-sidebar {
    border-right: 2px solid #e8e4df;
    padding-right: 2rem;
}

.video-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.video-tree-header h3 {
    color: #1a365d;
    margin: 0;
    font-size: 1.1rem;
    font-family: var(--font-heading);
}

.video-tree-actions {
    display: flex;
    gap: 0.5rem;
}

.tree-header-actions {
    display: flex;
    gap: 0.4rem;
}

.tree {
    /* Pas de scroll - le contenu prend sa place naturelle */
}

.tree-item {
    cursor: pointer;
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    color: #1a1a1a;
    user-select: none;
    -webkit-user-select: none;
}

.tree-item-content:hover {
    background: rgba(201, 169, 97, 0.1);
}

.tree-item-content.selected {
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.2) 0%, rgba(201, 169, 97, 0.1) 100%);
    color: #1a365d;
    font-weight: 600;
}

.tree-item-toggle {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.tree-item-toggle:hover {
    color: #1a365d;
}

.tree-item-toggle.collapsed {
    transform: rotate(-90deg);
}

.tree-item-toggle svg {
    width: 14px;
    height: 14px;
}

.tree-item-icon {
    flex-shrink: 0;
}

.tree-item-label {
    flex: 1;
    font-size: 0.9rem;
}

.tree-item-label.folder {
    font-weight: 600;
    color: #1a365d;
}

.tree-item-children {
    margin-left: 0.5rem;
}

.video-tree-content {
    /* Pas de scroll ni de limite - le contenu prend sa place naturelle */
}

.video-details {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.video-details-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.video-thumbnail-preview {
    width: 200px;
    aspect-ratio: 2/3;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #f5f0e8 0%, #faf9f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    flex-shrink: 0;
}

.video-thumbnail-preview.empty {
    border: 2px dashed #e8e4df;
}

.video-thumbnail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-info {
    flex: 1;
}

.folder-header-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.video-info h2 {
    color: #1a365d;
    margin: 0 0 1rem 0;
    font-size: 1.75rem;
    font-family: var(--font-heading);
}

.video-stats {
    display: flex;
    gap: 2rem;
}

.video-stat {
    display: flex;
    flex-direction: column;
}

.video-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1a365d;
    font-family: var(--font-heading);
}

.video-stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.tags-section-inline {
    margin-top: 1.5rem;
}

.tags-section-inline .video-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.file-list {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0e8 100%);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid #e8e4df;
}

.file-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.file-item-info {
    flex: 1;
}

.file-item-name {
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 0.25rem;
}

.file-item-size {
    font-size: 0.85rem;
    color: #6b7280;
}

.children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 180px);
    gap: 1rem;
}

.child-item {
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid #e8e4df;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.child-item:hover {
    border-color: #c9a961;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.child-thumbnail {
    width: 100%;
    aspect-ratio: 2/3;
    background: linear-gradient(135deg, #f5f0e8 0%, #faf9f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.child-thumbnail.empty {
    border-bottom: 2px solid #e8e4df;
}

.child-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.child-thumbnail svg {
    font-size: 2rem;
    color: #6b7280;
}

.child-info {
    padding: 0.75rem;
}

.child-name {
    font-weight: 600;
    color: #1a365d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.child-type {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
}

.child-status {
    display: inline-block;
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

/* ========== QUALITY + TAGS ROW LAYOUT ========== */

.quality-tags-row {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.quality-column {
    flex-shrink: 0;
    min-width: 0;
}

.quality-column:empty {
    display: none;
}

.quality-column:empty + .tags-column {
    flex: 1;
}

.tags-column {
    flex: 1;
    min-width: 0;
}

.tags-column .tags-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tags-column .tags-section-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a365d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== QUALITY RATING SLIDER ========== */

.quality-rating-section {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.08) 0%, rgba(201, 169, 97, 0.04) 100%);
    border: 1px solid rgba(201, 169, 97, 0.2);
    border-radius: var(--radius-lg);
    width: 320px;
    flex-shrink: 0;
}

.quality-header {
    margin-bottom: 0.75rem;
}

.quality-header h4 {
    color: #1a365d;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slider-container {
    width: 100%;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    height: 12px;
    margin-bottom: 0.5rem;
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 6px;
    width: 100%;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    /* Dégradé fixe rouge → vert (couleurs douces) */
    background: linear-gradient(90deg, 
        #b86b6b 0%,      /* Rouge doux */
        #c4896a 25%,     /* Orange terre */
        #c9a961 50%,     /* Doré (couleur du site) */
        #8fb88a 75%,     /* Vert sauge */
        #5a8a6b 100%     /* Vert forêt doux */
    );
}

/* Overlay qui cache la partie non révélée */
.slider-track::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: calc(100% - var(--progress, 0%));
    background: #e5e1db;
    border-radius: 0 3px 3px 0;
    transition: width 0.15s ease-out;
}

/* Supprimer l'ancien ::before */
.slider-track::before {
    display: none;
}

.quality-slider {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: grab;
    outline: none;
    z-index: 2;
    margin: 0;
}

.quality-slider:active {
    cursor: grabbing;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border: 2px solid #c9a961;
    cursor: grab;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 3px rgba(201, 169, 97, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 5px rgba(201, 169, 97, 0.15);
    border-color: #b8983f;
}

.quality-slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
    cursor: grabbing;
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border: 2px solid #c9a961;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quality-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: #b8983f;
}

.quality-slider:focus::-webkit-slider-thumb {
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 4px rgba(201, 169, 97, 0.25);
}

.quality-slider:focus::-moz-range-thumb {
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.15),
        0 0 0 4px rgba(201, 169, 97, 0.25);
}

.quality-labels {
    display: flex;
    justify-content: space-between;
    padding: 0;
    margin-top: 0.25rem;
}

.quality-labels span {
    font-size: 0.7rem;
    font-weight: 500;
    color: #9ca3af;
    text-align: center;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 2px 0;
    border-radius: 4px;
    user-select: none;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.quality-labels span:hover {
    color: #6b7280;
}

.quality-labels span.active {
    color: #1a365d;
    font-weight: 700;
}

@media (max-width: 900px) {
    .quality-tags-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .quality-column {
        width: 100%;
    }

    .quality-rating-section {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .quality-slider::-webkit-slider-thumb,
    .quality-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
    }

    .quality-labels span {
        font-size: 0.65rem;
        padding: 2px;
    }

    .quality-rating-section {
        padding: 0.875rem 1rem;
    }
}

/* ========== TAGS MANAGEMENT ========== */

.tags-table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(201, 169, 97, 0.2);
    overflow: hidden;
}

.tags-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tags-table thead {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
}

.tags-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

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

.tags-table tbody tr {
    border-bottom: 1px solid #e8e4df;
    transition: background-color 0.2s ease;
}

.tags-table tbody tr:hover {
    background-color: #f9fafb;
}

.tags-table tbody tr:last-child {
    border-bottom: none;
}

.tags-table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

.tag-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tag-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tag-name {
    font-weight: 600;
    color: #1a365d;
}

.tag-description {
    color: #4a5568;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-count {
    text-align: center;
    font-weight: 600;
    color: #6b7280;
}

/* Unified tag badge style (matching catalog) */
.tag-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 1rem 0.4rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.tag-preview-badge:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.06);
}

.tag-preview-badge .tag-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Color Picker Styles */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.color-preset {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.color-preset:hover {
    transform: scale(1.12) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.color-preset.active {
    border-color: #c9a961;
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.2), 0 6px 16px rgba(201, 169, 97, 0.3);
}

.color-custom {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.color-custom input[type="color"] {
    width: 52px;
    height: 40px;
    border: 2px solid rgba(201, 169, 97, 0.3);
    border-radius: 8px;
    cursor: pointer;
    padding: 3px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.color-custom input[type="color"]:hover {
    border-color: #c9a961;
    box-shadow: 0 4px 10px rgba(201, 169, 97, 0.2);
}

.color-custom input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-custom input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-custom input[type="text"] {
    width: 110px;
    padding: 0.6rem 0.875rem;
    border: 1.5px solid rgba(201, 169, 97, 0.25);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-transform: uppercase;
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.color-custom input[type="text"]:focus {
    outline: none;
    border-color: #c9a961;
    background: #fafafa;
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
}

.tag-preview-container {
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(250, 249, 247, 0.8) 0%, rgba(201, 169, 97, 0.05) 100%);
    border-radius: 10px;
    border: 1.5px solid rgba(201, 169, 97, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* Tag badges in tree view */
.tree-item-tags {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.tree-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tree-tag-more {
    font-size: 0.65rem;
    color: #6b7280;
    font-weight: 600;
    background: #e8e4df;
    padding: 1px 5px;
    border-radius: 9999px;
    margin-left: 2px;
}

.tree-tag-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Tag selector for videos */
.tag-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tag-selector-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.625rem 0.875rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    align-items: center;
}

.tag-selector-selected:empty::before {
    content: 'Aucun tag sélectionné';
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
}

.tag-selector-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem 0.4rem 0.7rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.tag-selector-item button {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    font-size: 0.75rem;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.tag-selector-item button:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    opacity: 1;
    transform: rotate(90deg);
}

.tag-selector-dropdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border: 1.5px solid rgba(201, 169, 97, 0.2);
    max-height: 160px;
    overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.tag-selector-option {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tag-selector-option:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.tag-selector-option.selected {
    opacity: 1;
    border-color: #c9a961;
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.15);
}

.tag-selector-empty {
    color: #6b7280;
    font-size: 0.875rem;
    font-style: italic;
    padding: 0.5rem;
    text-align: center;
    width: 100%;
}

/* ========== CUSTOM SCROLLBAR FOR MODALS ========== */

.modal-body::-webkit-scrollbar {
    width: 10px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(201, 169, 97, 0.05);
    border-radius: 0 10px 10px 0;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(201, 169, 97, 0.4) 0%, rgba(201, 169, 97, 0.6) 100%);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(201, 169, 97, 0.6) 0%, rgba(201, 169, 97, 0.8) 100%);
}

.tag-selector-dropdown::-webkit-scrollbar {
    width: 8px;
}

.tag-selector-dropdown::-webkit-scrollbar-track {
    background: rgba(201, 169, 97, 0.05);
    border-radius: 0 8px 8px 0;
}

.tag-selector-dropdown::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 97, 0.4);
    border-radius: 4px;
}

.tag-selector-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 169, 97, 0.6);
}

/* Firefox scrollbar */
.modal-body,
.tag-selector-dropdown {
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 169, 97, 0.6) rgba(201, 169, 97, 0.1);
}

/* ========== REFERRAL SETTINGS TOGGLE ========== */

.referral-settings-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.08) 0%, rgba(201, 169, 97, 0.04) 100%);
    border: 1px solid rgba(201, 169, 97, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e1db;
    transition: 0.3s;
    border-radius: 26px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #c9a961 0%, #d4b574 100%);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a365d;
}

/* ========== REFERRER COLUMN ========== */

.referrer-cell {
    min-width: 100px;
}

.referrer-name {
    color: #1a365d;
    font-weight: 500;
}

.no-referrer {
    color: #9ca3af;
}

/* ========== MESSAGES TAB ========== */

.messages-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(201, 169, 97, 0.2);
}

.messages-filters .search-input {
    flex: 1;
    min-width: 200px;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e8e4df;
    border-radius: var(--radius-md);
    background: white;
    color: #1a1a1a;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #c9a961;
    box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.1);
}

/* Messages Table - same pattern as users-table */
.messages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.messages-table thead {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: white;
}

.messages-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    cursor: col-resize;
    position: relative;
}

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

.messages-table tbody tr {
    border-bottom: 1px solid #e8e4df;
    transition: background-color 0.2s ease;
}

.messages-table tbody tr:hover {
    background-color: #f9fafb;
}

.messages-table tbody tr:last-child {
    border-bottom: none;
}

.messages-table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
}

/* Unread message row */
.message-unread {
    background-color: rgba(37, 99, 235, 0.04);
}

.message-unread td:first-child {
    position: relative;
}

.message-unread td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #2563eb;
}

/* Status Badges - Professional style */
.message-status-badge {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.message-status-new {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.message-status-read {
    background: rgba(201, 169, 97, 0.1);
    color: #92722d;
    border: 1px solid rgba(201, 169, 97, 0.25);
}

.message-status-processed {
    background: rgba(5, 150, 105, 0.1);
    color: #047857;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.message-status-archived {
    background: rgba(107, 114, 128, 0.1);
    color: #4b5563;
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* Subject Badges - Professional style */
.message-subject-badge {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.message-subject-bug {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.message-subject-idea {
    background: rgba(201, 169, 97, 0.1);
    color: #92722d;
    border: 1px solid rgba(201, 169, 97, 0.25);
}

.message-subject-question {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.message-subject-other {
    background: rgba(107, 114, 128, 0.08);
    color: #4b5563;
    border: 1px solid rgba(107, 114, 128, 0.15);
}

/* Sender cell */
.message-sender {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.message-sender-name {
    font-weight: 600;
    color: #1a365d;
    font-size: 0.875rem;
}

.message-sender-email {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Content preview */
.message-content-preview {
    color: #4a5568;
    font-size: 0.85rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Date cell */
.message-date-cell {
    color: #6b7280;
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Message Detail Modal */
.message-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.message-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-detail-item label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.message-detail-item span {
    color: #1a365d;
    font-size: 0.9rem;
}

.message-detail-full {
    grid-column: 1 / -1;
}

.message-detail-content {
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0e8 100%);
    border: 1px solid rgba(201, 169, 97, 0.2);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #1a1a1a;
    max-height: 250px;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* Status Select Modal */
.status-select-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-select-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border: 1.5px solid #e8e4df;
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a365d;
    width: 100%;
    text-align: left;
}

.status-select-item:hover {
    border-color: #c9a961;
    background: rgba(201, 169, 97, 0.03);
}

.status-select-item.active {
    border-color: #c9a961;
    background: rgba(201, 169, 97, 0.06);
}

.status-select-item svg {
    margin-left: auto;
    color: #059669;
}

.status-select-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-select-label {
    flex: 1;
}

/* Badge count for nav */
.admin-badge-count {
    background: #dc2626;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 9999px;
    margin-left: 0.4rem;
    min-width: 16px;
    text-align: center;
    line-height: 1.3;
}

/* Pagination ellipsis */
.pagination-ellipsis {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ========== REFERRAL SLOTS MANAGEMENT ========== */

/* Section for referral grant in message detail modal */
.message-detail-referral-section {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.06) 0%, rgba(5, 150, 105, 0.02) 100%);
    border: 1.5px solid rgba(5, 150, 105, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 0.5rem;
}

.message-detail-referral-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #047857 !important;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.message-detail-referral-section label svg {
    color: #059669;
}

/* Referral grant form */
.referral-grant-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.referral-slots-input {
    width: 70px;
    padding: 0.5rem 0.75rem;
    border: 1.5px solid rgba(5, 150, 105, 0.3);
    border-radius: var(--radius-md);
    background: white;
    color: #1a365d;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
}

.referral-slots-input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.referral-slots-label {
    color: #4a5568;
    font-size: 0.875rem;
}

/* Success button style for granting slots */
.admin-layout .btn-success,
.modal .btn-success {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.admin-layout .btn-success:hover,
.modal .btn-success:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

.admin-layout .btn-success:disabled,
.modal .btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Ghost button style */
.admin-layout .btn-ghost,
.modal .btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
    box-shadow: none;
}

.admin-layout .btn-ghost:hover,
.modal .btn-ghost:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #4b5563;
}

/* Modal field inline layout for users modal */
.modal-field-inline {
    margin-bottom: 1.5rem;
}

.modal-field-inline label {
    display: block;
    color: #1a365d;
    font-weight: 600;
    margin-bottom: 0.625rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    padding-left: 0.5rem;
}

.modal-field-inline label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #059669 0%, #10b981 100%);
    border-radius: 2px;
}

/* Referral slots edit container */
.referral-slots-edit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.04) 0%, rgba(5, 150, 105, 0.02) 100%);
    border: 1.5px solid rgba(5, 150, 105, 0.15);
    border-radius: var(--radius-md);
}

.referral-slots-current {
    color: #047857;
    font-weight: 600;
    font-size: 0.9rem;
}

.referral-slots-add {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.referral-slots-add .referral-slots-input {
    width: 60px;
}

/* Admin response section in message detail */
.message-detail-response-section {
    margin-top: 1rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(37, 99, 235, 0.02) 100%);
    border: 1.5px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.message-detail-response-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1d4ed8 !important;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.message-detail-response-section label svg {
    color: #2563eb;
}

.message-response-date {
    font-weight: 400;
    font-size: 0.75rem;
    color: #6b7280 !important;
    margin-left: 0.5rem;
}

.message-detail-response-section textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-md);
    background: white;
    color: #1a1a1a;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.2s ease;
}

.message-detail-response-section textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.message-detail-response-section textarea::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.message-detail-response-section small {
    display: block;
    margin-top: 0.5rem;
    color: #6b7280;
    font-size: 0.75rem;
    text-align: right;
}

/* Subject badge for referral */
.message-subject-referral {
    background: rgba(5, 150, 105, 0.08);
    color: #047857;
    border: 1px solid rgba(5, 150, 105, 0.2);
}
