/* Users Page Styles */

.users-page {
    max-width: 2500px;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-title p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Stats Row */
.users-page .stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 16px 20px;
}

.stat-card.highlight {
    border-color: var(--color-success-light);
    background: #ecfdf5;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.highlight .stat-label {
    color: var(--color-success-text);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card.highlight .stat-value {
    color: var(--color-success-text);
}

.stat-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Status Tabs */
.status-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.status-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    position: relative;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-tab:hover {
    color: var(--text-secondary);
}

.status-tab.active {
    color: var(--text-primary);
}

.status-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-primary);
}

.tab-count {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.status-tab.active .tab-count {
    background: var(--text-primary);
    color: white;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.filters-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--text-faint);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-dropdown i {
    color: var(--text-placeholder);
}

.filter-dropdown select {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--text-faint);
    border-radius: 8px;
    min-width: 220px;
}

.search-box i {
    color: var(--text-placeholder);
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-secondary);
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-placeholder);
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-danger {
    background: var(--color-danger-bg-subtle);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-bg-subtle);
    border: 1px solid var(--color-success-border);
    color: var(--color-success-light);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Loading & Empty State */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.empty-state {
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-faint);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Users Table */
.users-table {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.users-page .table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 100px 110px 100px 120px 220px;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.users-page .user-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 100px 110px 100px 120px 220px;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-tertiary);
    align-items: center;
    transition: background 0.15s;
}

.user-row:last-child {
    border-bottom: none;
}

.user-row:hover {
    background: var(--bg-secondary);
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.email-cell {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.date-cell {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Role Badge */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.owner {
    background: var(--color-primary-bg);
    color: var(--color-info-text);
}

.role-badge.admin {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.role-badge.member {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.active {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.status-badge.active .status-dot {
    background: var(--color-success-light);
}

.status-badge.inactive {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.status-badge.inactive .status-dot {
    background: var(--text-placeholder);
}

/* Actions Cell */
.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.owner-badge {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: white;
    border: 1px solid var(--border-primary);
    border-top: none;
    border-radius: 0 0 12px 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-info strong {
    color: var(--text-primary);
}

/* Buttons — see design-tokens.css for the canonical .btn / .btn-primary /
   .btn-secondary / .btn-sm / .btn-danger rules. Page-scoped variants only. */
.btn-danger-outline {
    background: white;
    border: 1px solid var(--text-faint);
    color: var(--color-danger);
}

.btn-danger-outline:hover {
    background: var(--color-danger-bg-subtle);
    border-color: var(--color-danger);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
}

.modal.show {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    width: 560px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: hidden;
    z-index: 301;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal.show.modal-sm {
    width: 420px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--border-primary);
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Styles */
.users-page .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--color-danger);
}

.form-input {
    padding: 10px 12px;
    border: 1px solid var(--text-faint);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-placeholder);
}

.validation-error {
    font-size: 12px;
    color: var(--color-danger);
}

.section-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 20px 0;
}

.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-primary-bg);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--color-info-text);
}

.info-banner i {
    margin-top: 2px;
}

.role-info {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 8px;
}

.role-item {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.role-item:last-child {
    margin-bottom: 0;
}

.role-item strong {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .users-page .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .users-page .stats-row {
        grid-template-columns: 1fr;
    }

    .users-page .table-header,
    .users-page .user-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .table-header {
        display: none;
    }

    .user-row {
        padding: 16px;
    }

    .modal.show {
        width: 95vw;
    }

    .users-page .form-row {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   ApproverGroupsManager — embedded on the Users page's "Approver Groups"
   top-level tab. The group card / editor / member-picker styles live in
   templates.css (they're not page-scoped) and apply here too; this block
   only adds the manager-specific header.
   ════════════════════════════════════════════════════════════════════════ */
.approver-groups-manager {
    padding: 8px 0;
}

.approver-groups-manager .manager-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.approver-groups-manager .manager-title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.approver-groups-manager .manager-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    max-width: 720px;
}
