/* Controls Page — Users Tab */

/* ===== Users Tab ===== */
.users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.users-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-add-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

/* User Row — single-line compact */
.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s ease;
}

.user-row:last-child {
    border-bottom: none;
}

.user-row:hover {
    background: var(--bg-hover);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "You" badge — inline */
.user-you-badge {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 1px 7px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-shrink: 0;
}

/* Segmented Role Tabs */
.role-tabs {
    display: flex;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.role-tab {
    padding: 4px 12px;
    font-size: 0.72rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    border-right: 1px solid var(--border-color);
}

.role-tab:last-child {
    border-right: none;
}

.role-tab:hover:not(.active):not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.role-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.role-tab.active {
    font-weight: 600;
    color: white;
}

.role-tab.active.role-admin {
    background: #8b5cf6;
}

.role-tab.active.role-marketing_ops {
    background: #f59e0b;
    color: #000;
}

.role-tab.active.role-marketing_admin {
    background: #0984e3;
}

.role-tab.active.role-viewer {
    background: #6b7280;
}

/* Remove button — x icon */
.user-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    line-height: 1;
}

.user-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.user-remove-placeholder {
    width: 28px;
    flex-shrink: 0;
}

/* Locked / Empty state */
.users-locked {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.users-locked svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.users-locked h3 {
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.users-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Add User Modal Form */
.user-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-form-field label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.user-form-field input,
.user-form-field select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-dark, #0f1117);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-form-field input:focus,
.user-form-field select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .user-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .user-info {
        flex-basis: 100%;
    }

    .role-tabs {
        flex: 1;
    }
}

/* ========================================================
   LIGHT THEME — Users Tab
   ======================================================== */

/* ── User Rows ── */
html[data-theme="light"] .users-list { box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .user-row:hover { background: #f5f0e8; }
html[data-theme="light"] .role-tabs { background: #f2ece2; border-color: #d9d0c3; }
html[data-theme="light"] .role-tab { border-right-color: #d9d0c3; color: #6b7280; }
html[data-theme="light"] .role-tab:hover:not(.active):not(:disabled) { background: #ebe4d8; }
html[data-theme="light"] .role-tab.active.role-admin { color: #fff; }
html[data-theme="light"] .role-tab.active.role-marketing_admin { color: #fff; }
html[data-theme="light"] .role-tab.active.role-marketing_ops { color: #000; }
html[data-theme="light"] .role-tab.active.role-viewer { color: #fff; }
