@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.fade-in-up { animation: fadeInUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards; opacity: 0; }
.scale-in { animation: scaleIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* Card container */
.users-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(32, 62, 39, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.users-card-header {
    background: linear-gradient(135deg, #203E27, #1A321F);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #C5A065;
}

.users-card-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.users-card-icon {
    width: 38px;
    height: 38px;
    background: rgba(197, 160, 101, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #C5A065;
    font-size: 1.1rem;
}

.users-card-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.btn-add-user {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #C5A065, #B08A4E);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(197, 160, 101, 0.3);
}

.btn-add-user:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(197, 160, 101, 0.45);
}

.users-card-body {
    padding: 0;
    background: #FDFBF7;
}

/* Loading */
.users-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem;
}

.loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(197, 160, 101, 0.15);
    border-top-color: #C5A065;
    border-radius: 50%;
    animation: spinRing 1s linear infinite;
}

.loading-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #C5A065;
    animation: pulse 1.5s ease infinite;
}

.loading-text { color: #666; font-size: 0.9rem; }

/* Alerts */
.users-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    margin: 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
}

.users-alert i { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }

.users-alert-danger {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc3545;
    color: #991b1b;
}

.users-empty {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.users-empty i { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; color: #ccc; }

/* Table */
.users-table-wrapper {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead th {
    background: rgba(32, 62, 39, 0.04);
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #203E27;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid rgba(197, 160, 101, 0.2);
}

.users-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.85rem;
}

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

.user-row:hover {
    background: rgba(197, 160, 101, 0.04);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, rgba(32, 62, 39, 0.08), rgba(32, 62, 39, 0.04));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #203E27;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-email {
    font-weight: 600;
    color: #203E27;
    font-size: 0.85rem;
}

.user-name-sub {
    font-size: 0.75rem;
    color: #999;
}

.user-office {
    color: #666;
    font-size: 0.85rem;
}

.user-date {
    color: #999;
    font-size: 0.8rem;
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-admin {
    background: rgba(197, 160, 101, 0.15);
    color: #8B6914;
}

.role-user {
    background: rgba(32, 62, 39, 0.08);
    color: #203E27;
}

/* Action buttons */
.action-btns {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    color: #888;
    font-size: 0.85rem;
}

.action-edit:hover { background: rgba(197, 160, 101, 0.12); color: #C5A065; }
.action-key:hover { background: rgba(255, 193, 7, 0.12); color: #d4a017; }
.action-delete:hover { background: rgba(220, 53, 69, 0.08); color: #dc3545; }

/* Modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 1rem;
}

.modal-card {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-card-sm { max-width: 440px; }

.modal-card-header {
    background: linear-gradient(135deg, #203E27, #1A321F);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    border-bottom: 3px solid #C5A065;
}

.modal-card-header-warning {
    background: linear-gradient(135deg, #6d5000, #4a3600);
    border-bottom-color: #ffc107;
}

.modal-card-header-danger {
    background: linear-gradient(135deg, #7a1a1a, #5a1010);
    border-bottom-color: #dc3545;
}

.modal-card-icon {
    width: 38px; height: 38px;
    background: rgba(197, 160, 101, 0.2);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #C5A065; font-size: 1.1rem; flex-shrink: 0;
}

.modal-card-icon-warning { background: rgba(255, 193, 7, 0.2); color: #ffd54f; }
.modal-card-icon-danger { background: rgba(255, 100, 100, 0.2); color: #ff8a8a; }

.modal-card-title {
    color: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.modal-close-btn {
    position: absolute; top: 1rem; right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none; color: rgba(255, 255, 255, 0.7);
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; font-size: 0.85rem;
}

.modal-close-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.modal-card-body { padding: 1.75rem; background: #FDFBF7; }

/* Form elements */
.form-group-modern { margin-bottom: 1.25rem; }
.form-group-modern:last-child { margin-bottom: 0; }

.form-label-modern {
    display: block; font-size: 0.85rem;
    font-weight: 600; color: #203E27; margin-bottom: 0.5rem;
}

.optional-tag { font-weight: 400; color: #aaa; font-size: 0.75rem; margin-left: 0.25rem; }

.form-input-modern {
    width: 100%;
    padding: 0.875rem 1.125rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: #fff;
    color: #203E27;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    outline: none;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    line-height: 1.5;
}

.form-input-modern:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.form-input-modern:focus {
    border-color: #C5A065;
    box-shadow: 
        0 0 0 4px rgba(197, 160, 101, 0.12),
        0 4px 12px rgba(197, 160, 101, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
    background: #fff;
}

.form-input-modern::placeholder {
    color: #bbb;
    font-weight: 400;
    opacity: 0.8;
}

.form-input-modern:disabled {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Styles pour les composants Blazor InputText */
::deep .form-input-modern,
::deep input.form-input-modern,
::deep input[type="text"],
::deep input[type="email"],
::deep input[type="password"],
::deep input[type="number"] {
    width: 100% !important;
    padding: 0.875rem 1.125rem !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 12px !important;
    font-size: 0.95rem !important;
    background: #fff !important;
    color: #203E27 !important;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
    outline: none !important;
    font-family: inherit !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    line-height: 1.5 !important;
}

::deep .form-input-modern:hover,
::deep input.form-input-modern:hover,
::deep input[type="text"]:hover,
::deep input[type="email"]:hover,
::deep input[type="password"]:hover {
    border-color: #d0d0d0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

::deep .form-input-modern:focus,
::deep input.form-input-modern:focus,
::deep input[type="text"]:focus,
::deep input[type="email"]:focus,
::deep input[type="password"]:focus {
    border-color: #C5A065 !important;
    box-shadow: 
        0 0 0 4px rgba(197, 160, 101, 0.12),
        0 4px 12px rgba(197, 160, 101, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-1px) !important;
    background: #fff !important;
}

::deep .form-input-modern::placeholder,
::deep input.form-input-modern::placeholder,
::deep input[type="text"]::placeholder,
::deep input[type="email"]::placeholder,
::deep input[type="password"]::placeholder {
    color: #bbb !important;
    font-weight: 400 !important;
    opacity: 0.8 !important;
}

::deep .form-input-modern:disabled,
::deep input.form-input-modern:disabled,
::deep input[type="text"]:disabled,
::deep input[type="email"]:disabled,
::deep input[type="password"]:disabled {
    background: #f5f5f5 !important;
    border-color: #e0e0e0 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

/* Role selector */
.role-selector {
    display: flex;
    gap: 0.75rem;
}

.role-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.role-option input { display: none; }

.role-option:hover {
    border-color: #C5A065;
    color: #203E27;
}

.role-option-active {
    border-color: #C5A065;
    background: rgba(197, 160, 101, 0.08);
    color: #203E27;
    font-weight: 600;
}

/* Modal footer */
.modal-card-footer {
    padding: 1rem 1.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #fff;
    border-top: 1px solid #eee;
}

.btn-modal-cancel {
    padding: 0.6rem 1.25rem;
    border: 2px solid #ddd; background: #fff;
    border-radius: 8px; color: #666;
    font-weight: 500; font-size: 0.85rem;
    cursor: pointer; transition: all 0.25s ease;
}

.btn-modal-cancel:hover { background: #f5f5f5; border-color: #ccc; color: #333; }

.btn-modal-confirm {
    padding: 0.6rem 1.5rem; border: none;
    background: linear-gradient(135deg, #203E27, #1A321F);
    border-radius: 8px; color: #fff;
    font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: all 0.25s ease;
    display: flex; align-items: center;
}

.btn-modal-confirm:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(32, 62, 39, 0.3);
}

.btn-modal-confirm:disabled, .btn-modal-danger:disabled, .btn-modal-warning:disabled {
    opacity: 0.5; cursor: not-allowed;
}

.btn-modal-warning {
    padding: 0.6rem 1.5rem; border: none;
    background: linear-gradient(135deg, #d4a017, #b8860b);
    border-radius: 8px; color: #fff;
    font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: all 0.25s ease;
    display: flex; align-items: center;
}

.btn-modal-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.35);
}

.btn-modal-danger {
    padding: 0.6rem 1.5rem; border: none;
    background: linear-gradient(135deg, #dc3545, #b02a37);
    border-radius: 8px; color: #fff;
    font-weight: 600; font-size: 0.85rem;
    cursor: pointer; transition: all 0.25s ease;
    display: flex; align-items: center;
}

.btn-modal-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.35);
}

/* Delete/Reset modal extras */
.delete-user-name, .reset-user-info {
    font-size: 0.95rem;
    color: #203E27;
    padding: 0.75rem 1rem;
    background: rgba(32, 62, 39, 0.04);
    border-radius: 8px;
    border-left: 3px solid #C5A065;
    margin-bottom: 1rem;
}

.delete-warning {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .users-table thead th,
    .users-table tbody td {
        padding: 0.65rem 0.5rem;
        font-size: 0.8rem;
    }

    .action-btns { flex-direction: column; }
}
