/*
 * AIM Authentication UI - Component Styles
 * Purpose: Styles for auth RCL components (profile, manage, shared elements)
 * Dependencies: Relies on design tokens from aim-consolidated.css / theme-definitions.css
 *
 * Login/Register form styles remain in wwwroot/css/login-page.css (loaded by _LoginLayout.cshtml)
 * This file covers:
 *   - Validation summary (shared across login/register)
 *   - Divider styling (shared across login/register)
 *   - Profile page (MyProfile.razor)
 *   - Groups list (GroupsList.razor)
 *   - Manage pages (ChangePassword, Email, 2FA, etc.)
 *   - Status pages (Confirmation, Lockout, AccessDenied, etc.)
 *   - Authorization components (GroupCreate, GroupEdit, GroupCard)
 */

/* ==========================================================================
   SHARED AUTH ELEMENTS
   ========================================================================== */

/* Validation summary - errors from PageModel ModelState */
.login-validation-summary {
    background-color: var(--color-error-100);
    border: 1px solid var(--color-error-500, #dc3545);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.login-validation-summary p {
    margin: 0.25rem 0;
}

.login-text-danger {
    color: var(--color-error-500, #dc3545);
    font-size: var(--font-size-sm);
}

/* Divider between form and external providers */
.login-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.login-divider::before {
    content: '';
    display: block;
    border-top: 1px solid var(--color-border, #ccc);
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
}

.login-divider-text {
    background: var(--surface-raised);
    padding: 0 15px;
    color: var(--color-text-muted, #666);
    font-size: var(--font-size-sm);
    position: relative;
    z-index: 1;
}

/* External login section spacing */
.external-login-section {
    margin-top: 8px;
}

/* Register section link button */
.register-section {
    margin-top: 8px;
}

/* Login links section */
.login-links {
    margin-top: 1rem;
    text-align: center;
}

.login-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
}

.login-links a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   STATUS MESSAGE STYLES (used across manage pages)
   ========================================================================== */

.auth-status-success {
    background-color: var(--color-success-100);
    color: var(--color-success-700);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--color-success-100, #D1FAE5);
}

.auth-status-error {
    background-color: var(--color-error-100);
    color: var(--color-error-700);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--color-error-100, #FEE2E2);
}

.auth-status-warning {
    background-color: var(--color-warning-100);
    color: var(--color-warning-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
    border: 1px solid var(--color-warning-100, #FEF3C7);
}

.auth-status-info {
    background-color: var(--color-info-100);
    color: var(--color-info-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
    border: 1px solid var(--color-info-100, #E0F2FE);
}

.auth-status-warning p,
.auth-status-info p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.auth-status-warning p:last-child,
.auth-status-info p:last-child {
    margin-bottom: 0;
}

.auth-status-warning a {
    color: var(--color-warning-700);
    font-weight: 600;
}

.auth-status-info a {
    color: var(--color-info-700);
    font-weight: 600;
}

/* ==========================================================================
   MANAGE PAGE CONTAINER
   Consistent wrapper for all Account/Manage pages
   ========================================================================== */

.manage-container {
    max-width: 600px;
}

.manage-container h3 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.manage-container h4 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-primary);
    font-size: var(--font-size-md);
}

/* ==========================================================================
   2FA MANAGEMENT STYLES
   ========================================================================== */

.twofa-enabled-banner {
    background-color: var(--color-success-100);
    color: var(--color-success-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
}

.twofa-enabled-banner h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--color-success-700);
}

.twofa-recovery-danger {
    background-color: var(--color-error-100);
    color: var(--color-error-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
}

.twofa-recovery-warning {
    background-color: var(--color-warning-100);
    color: var(--color-warning-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
}

.twofa-browser-info {
    background-color: var(--color-info-100);
    color: var(--color-info-700);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    text-align: left;
}

.twofa-settings-panel {
    background-color: var(--surface-base, #f8f9fa);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.twofa-settings-panel h4 {
    margin-top: 0;
    font-size: var(--font-size-md);
}

.twofa-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ==========================================================================
   AUTHENTICATOR SETUP STYLES
   ========================================================================== */

.authenticator-steps {
    counter-reset: step;
}

.authenticator-step {
    background-color: var(--surface-base, #f8f9fa);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.authenticator-step h4 {
    margin-top: 0;
    font-size: var(--font-size-md);
}

.authenticator-apps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.qr-code-container {
    text-align: center;
    margin: 1rem 0;
}

.qr-code-container #qrCode {
    display: inline-block;
    padding: 1rem;
    background: var(--surface-raised);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
}

.manual-key-display {
    background-color: var(--surface-base);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    text-align: center;
}

.manual-key-display code {
    background-color: var(--surface-raised);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    border: 1px solid var(--color-border);
}

/* ==========================================================================
   RECOVERY CODES DISPLAY
   ========================================================================== */

.recovery-codes-grid {
    background-color: var(--surface-base);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    line-height: 2;
}

.recovery-codes-grid code {
    margin-right: 1rem;
    background-color: var(--surface-raised);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    border: 1px solid var(--color-border);
}

/* ==========================================================================
   EXTERNAL LOGINS MANAGEMENT
   ========================================================================== */

.external-logins-list {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.external-login-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border, #dee2e6);
}

.external-login-item:last-child {
    border-bottom: none;
}

.external-login-provider-name {
    font-weight: 500;
}

.add-login-section {
    margin-top: 1.5rem;
}

.add-login-providers {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   PERSONAL DATA MANAGEMENT
   ========================================================================== */

.personal-data-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.personal-data-warning {
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Danger button variant */
.login-btn-danger {
    display: block;
    width: 100%;
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    background-color: var(--color-error-500, #dc3545);
    color: var(--color-white);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
}

.login-btn-danger:hover {
    background-color: var(--color-error-700);
}

/* ==========================================================================
   INVITATION PAGE STYLES
   ========================================================================== */

.invitation-container {
    max-width: 500px;
    margin: 40px auto;
}

.invitation-status {
    text-align: center;
    padding: 2rem;
    background: var(--surface-base, #f8f9fa);
    border-radius: var(--radius-md);
}

.invitation-status-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.invitation-status h3 {
    margin-bottom: 0.75rem;
}

.invitation-status p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.invitation-email-badge {
    background-color: var(--surface-base);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.invitation-email-badge small {
    color: var(--color-text-secondary);
}

.invitation-message {
    background-color: var(--color-info-100);
    border: 1px solid var(--color-info-100, #E0F2FE);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.invitation-name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* ==========================================================================
   PENDING REGISTRATION STYLES
   ========================================================================== */

.pending-reg-section-header {
    text-align: left;
    margin-bottom: 0.75rem;
    font-size: var(--font-size-md);
    color: var(--color-primary);
}

.pending-reg-info-box {
    background-color: var(--surface-base);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1.5rem;
    text-align: left;
    border-left: 4px solid var(--login-register-bg, #008E70);
}

.pending-reg-info-box h4 {
    margin-top: 0;
    font-size: var(--font-size-md);
}

/* ==========================================================================
   REACTIVATION REQUEST STYLES
   ========================================================================== */

.reactivation-user-info {
    text-align: left;
    margin-bottom: 1rem;
}

.reactivation-user-info label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted, #666);
}

.reactivation-user-info p {
    font-weight: 600;
    margin: 0.25rem 0 0 0;
}

/* ==========================================================================
   PROFILE PAGE STYLES (MyProfile.razor)
   Uses .profile-* prefix to avoid conflicts with main app styles
   ========================================================================== */

.profile-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 0;
}

.profile-title {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
}

/* Profile alerts */
.profile-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.profile-alert-success {
    background-color: var(--color-success-100);
    color: var(--color-success-700);
    border: 1px solid var(--color-success-100, #D1FAE5);
}

.profile-alert-error {
    background-color: var(--color-error-100);
    color: var(--color-error-700);
    border: 1px solid var(--color-error-100, #FEE2E2);
}

.profile-loading {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-muted, #666);
    font-size: var(--font-size-md);
}

/* Profile grid layout */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .authenticator-apps-grid {
        grid-template-columns: 1fr;
    }

    .invitation-name-grid {
        grid-template-columns: 1fr;
    }
}

/* Profile cards */
.profile-card {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.profile-card-full {
    margin-top: 1.5rem;
}

.profile-card-header {
    background: var(--surface-base, #f8f9fa);
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border, #dee2e6);
    color: var(--color-primary);
    display: flex;
    align-items: center;
}

.profile-card-body {
    padding: 1rem;
}

/* Definition list for profile details */
.profile-dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.profile-dl dt {
    font-weight: 500;
    color: var(--color-text-muted, #666);
    font-size: var(--font-size-sm);
}

.profile-dl dd {
    margin: 0;
    font-size: var(--font-size-sm);
}

/* Badges */
.profile-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--color-white);
}

.profile-badge-success {
    background: var(--color-success-medium, #28a745);
}

.profile-badge-danger {
    background: var(--color-error-500, #dc3545);
}

.profile-badge-warning {
    background: var(--color-warning-medium, #ffc107);
    color: var(--color-text-primary);
}

.profile-badge-neutral {
    background: var(--color-text-muted, #6c757d);
}

.profile-badge-info {
    background: var(--color-primary);
}

.profile-muted {
    color: var(--color-text-muted, #999);
}

/* Dividers */
.profile-divider {
    margin: 1rem 0;
    border: none;
    border-top: 1px solid var(--color-border, #dee2e6);
}

/* Action buttons */
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-action-btn {
    display: block;
    text-align: center;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: var(--font-size-sm);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.profile-action-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
}

.profile-action-btn-danger {
    border-color: var(--color-error-500, #dc3545);
    color: var(--color-error-500, #dc3545);
}

.profile-action-btn-danger:hover {
    background: var(--color-error-500, #dc3545);
    color: var(--color-white);
}

.profile-action-btn-small {
    padding: 0.125rem 0.5rem;
    font-size: var(--font-size-xs);
}

/* Tables */
.profile-table-container {
    overflow-x: auto;
}

.profile-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-sm);
}

.profile-table thead th {
    background: var(--surface-base, #f8f9fa);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--color-border, #dee2e6);
    color: var(--color-primary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border, #f0f0f0);
    vertical-align: middle;
}

.profile-table tbody tr:hover {
    background: var(--surface-base, #fafafa);
}

.profile-row-current {
    background: var(--primary-alpha-10, rgba(15, 36, 68, 0.1));
}

.profile-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   GROUPS LIST STYLES (GroupsList.razor)
   Uses standard .component-container, .data-table etc. from the component
   ========================================================================== */

.component-container {
    padding: 1rem;
}

.groups-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.groups-list-header h4 {
    margin: 0;
    font-weight: 600;
    color: var(--color-primary);
}

.groups-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-box input {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    min-width: 200px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.groups-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-sm);
}

.data-table thead th {
    background: var(--surface-base, #f8f9fa);
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--color-border, #dee2e6);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border, #f0f0f0);
    vertical-align: middle;
}

.data-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.data-row:hover {
    background: var(--surface-base, #fafafa);
}

.group-name {
    font-weight: 500;
}

.beacon-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted, #999);
}

/* ==========================================================================
   AUTHORIZATION UI - GROUP CARD STYLES
   ========================================================================== */

.group-card {
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-raised);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    cursor: pointer;
}

.group-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.group-card.selected {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}

.group-card-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--color-border, #f0f0f0);
}

.group-beacon {
    width: 8px;
    height: 40px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.group-info {
    flex: 1;
    min-width: 0;
}

.group-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-company {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #666);
}

.group-card-body {
    padding: 0.75rem 1rem;
}

.group-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-icon {
    font-size: var(--font-size-xl);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-weight: 600;
    font-size: var(--font-size-md);
    line-height: 1;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #666);
}

.group-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-item {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #666);
}

.group-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--surface-base, #f8f9fa);
    border-top: 1px solid var(--color-border, #f0f0f0);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.beacon-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.beacon-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #666);
}

.group-card-hover-actions {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-raised-alpha, rgba(255, 255, 255, 0.95));
    padding: 0.5rem;
    text-align: center;
    gap: 0.5rem;
    justify-content: center;
}

.group-card:hover .group-card-hover-actions {
    display: flex;
}

.selection-overlay {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.selection-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Action menu (3-dot) */
.action-menu {
    position: relative;
}

.action-menu-trigger {
    background: transparent;
    border: none;
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted, #666);
}

.action-menu-trigger:hover {
    background: var(--surface-base, #f0f0f0);
}

.action-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--surface-raised);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.menu-item:hover {
    background: var(--surface-base, #f8f9fa);
}

.menu-item.danger {
    color: var(--color-error-500, #dc3545);
}

.menu-item.danger:hover {
    background: var(--color-error-100);
}

/* ==========================================================================
   AUTHORIZATION UI - GROUP CREATE/EDIT FORM STYLES
   ========================================================================== */

.form-header {
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border, #dee2e6);
}

.form-header h4 {
    margin: 0;
    font-weight: 600;
    color: var(--color-primary);
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted, #333);
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.form-group input:disabled {
    background: var(--surface-base, #f8f9fa);
    color: var(--color-text-muted, #666);
}

.validation-error {
    color: var(--color-error-500, #dc3545);
    font-size: var(--font-size-xs);
}

.beacon-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    vertical-align: middle;
    margin-left: 0.5rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #dee2e6);
}

/* Edit tabs */
.edit-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border, #dee2e6);
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-muted, #666);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: var(--color-primary);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* Section toolbar (used in members tab) */
.section-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.section-toolbar input {
    flex: 1;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.status-badge.active {
    background: var(--color-success-100, #D1FAE5);
    color: var(--color-success-700, #065F46);
}

.status-badge.inactive {
    background: var(--color-error-100);
    color: var(--color-error-700);
}

.permission-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    background: var(--surface-base, #e9ecef);
    color: var(--color-primary);
}

/* Status message */
.status-message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: var(--font-size-sm);
}

.status-message.success {
    background: var(--color-success-100);
    color: var(--color-success-700);
}

.status-message.error {
    background: var(--color-error-100);
    color: var(--color-error-700);
}

/* ==========================================================================
   ACTION BUTTONS (shared across auth and authorization components)
   ========================================================================== */

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

.action-btn.primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.action-btn.primary:hover {
    opacity: 0.9;
}

.action-btn.danger {
    border-color: var(--color-error-500, #dc3545);
    color: var(--color-error-500, #dc3545);
}

.action-btn.danger:hover {
    background: var(--color-error-500, #dc3545);
    color: var(--color-white);
}

.action-btn.small {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-xs);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.actions-cell {
    display: flex;
    gap: 0.25rem;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
}

.page-info {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted, #666);
}

/* Loading and error states */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted, #666);
}

.error-message {
    text-align: center;
    padding: 1rem;
    color: var(--color-error-500, #dc3545);
    background: var(--color-error-100);
    border-radius: var(--radius-sm);
    margin: 1rem;
}

/* Modal overlay (no-Bootstrap custom modal) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal-box {
    background: var(--surface-raised);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 90%;
    overflow: hidden;
}

.modal-box-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border, #dee2e6);
}

.modal-box-header h5 {
    margin: 0;
    font-weight: 600;
}

.modal-box-body {
    padding: 1.25rem;
}

.modal-box-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--color-border, #dee2e6);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ==========================================================================
   PROFILE PHOTO SECTION
   ========================================================================== */

.profile-photo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-base, #f8f9fa);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

.profile-photo-container {
    flex-shrink: 0;
}

.profile-photo-img {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--color-white);
    box-shadow: var(--shadow-sm);
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark, #152b47));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--color-white);
    box-shadow: var(--shadow-sm);
}

.profile-photo-initials {
    color: var(--color-white);
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.profile-photo-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-photo-name {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--color-primary);
}

.profile-photo-email {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted, #666);
}

.profile-photo-company {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted, #666);
    font-weight: 500;
}

.profile-photo-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.profile-photo-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #999);
    margin: 0;
}

/* ==========================================================================
   PROFILE EDIT FORM
   ========================================================================== */

.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-form-group label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-muted, #333);
}

.profile-form-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    transition: border-color 0.15s ease;
}

.profile-form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.1);
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border, #dee2e6);
    margin-top: 0.5rem;
}

.profile-action-btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.profile-action-btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}

.profile-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */

.profile-quick-actions {
    margin-top: 1.5rem;
}

.profile-section-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

.profile-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.profile-quick-action-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.profile-quick-action-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.quick-action-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
}

.quick-action-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted, #666);
}

/* ==========================================================================
   LOADING SKELETON — PROFILE-SPECIFIC
   Generic skeleton classes (.skeleton-line, .skeleton-card, .skeleton-circle,
   .skeleton-line-small/medium/full etc.) are in wwwroot/css/skeleton-loading.css
   ========================================================================== */

.profile-skeleton {
    padding: 1.5rem 0;
}

.skeleton-photo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--surface-base, #f8f9fa);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

/* Profile avatar size override — generic .skeleton-circle has no dimensions */
.skeleton-photo-section .skeleton-circle {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.skeleton-text-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ==========================================================================
   RESPONSIVE - PROFILE PAGE
   ========================================================================== */

@media (max-width: 768px) {
    .profile-photo-section {
        flex-direction: column;
        text-align: center;
    }

    .profile-photo-actions {
        justify-content: center;
    }

    .profile-actions-grid {
        grid-template-columns: 1fr 1fr;
    }

    .skeleton-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .profile-container {
        padding: 1rem 0;
    }

    .profile-photo-img,
    .profile-photo-placeholder {
        width: 100px;
        height: 100px;
    }

    .profile-photo-initials {
        font-size: 2rem;
    }

    .profile-photo-name {
        font-size: var(--font-size-xl);
    }

    .profile-actions-grid {
        grid-template-columns: 1fr;
    }

    .profile-table {
        font-size: var(--font-size-xs);
    }
}
