/* Admin Dashboard & Agent Console Styles */

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

.admin-title-group h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.admin-title-group p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* Stats Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    width: 100%;
    appearance: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover,
.metric-card.is-active {
    transform: translateY(-3px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.metric-card.is-active {
    background: #f8fbff;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--color-border);
}

.metric-card.primary::before { background: var(--color-primary); }
.metric-card.warning::before { background: var(--color-warning); }
.metric-card.success::before { background: var(--color-success); }
.metric-card.danger::before { background: var(--color-secondary); }
.metric-card.info::before { background: var(--color-info); }

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.metric-value {
    font-size: 1.85rem;
    font-weight: 700;
    font-family: 'Lexend', sans-serif;
    color: var(--color-text-main);
}

.demande-actions-menu {
    position: relative;
    display: inline-block;
}

.demande-actions-menu summary {
    list-style: none;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.38rem 0.7rem;
    white-space: nowrap;
}

.demande-actions-menu summary::-webkit-details-marker { display: none; }

.demande-actions-list {
    position: absolute;
    z-index: 20;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 135px;
    padding: 0.35rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.demande-actions-list button {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-main);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    text-align: left;
}

.demande-actions-list button:hover { background: var(--color-bg); }
.demande-actions-list button.danger { color: var(--color-error); }

/* Filter Bar */
.filter-bar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

/* Data Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.admin-table th {
    background: #f8fafc;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.admin-table tbody tr:hover {
    background: #eef2ff;
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.admin-table tbody tr:active {
    background: #dbeafe;
}

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

/* Action Drawer / Sliding Panel */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 760px;
    background: var(--color-surface);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 1501;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.drawer-overlay.active .drawer-panel {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.drawer-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.drawer-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.drawer-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Tab Navigation inside Drawer */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.drawer-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.drawer-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Comment Thread */
.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.comment-bubble {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.comment-bubble.internal {
    border-left: 4px solid var(--color-warning);
    background: #fffbeb;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.comment-text {
    font-size: 0.875rem;
    color: var(--color-text-main);
}

/* Badges de Rôles */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.role-admin {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.role-supervisor {
    background: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.role-agent {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.role-applicant {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* User Account Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 4px;
}

.badge-status-active {
    background: #dcfce7;
    color: #15803d;
}

.badge-status-suspended, .badge-status-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

/* Settings Navigation Tabs */
.settings-nav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 2rem;
}

.settings-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-tab:hover {
    color: var(--color-primary);
}

.settings-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 700;
}
