/* Frontend User Management Modal Styles */

/* Main Button Container */
.fuc-button-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

/* Button Styles */
.fuc-button-container .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fuc-button-container .btn-primary {
    background: linear-gradient(135deg, #2F4F6F, #4A6B8A);
    color: #ffffff;
}

.fuc-button-container .btn-primary:hover {
    background: linear-gradient(135deg, #1e3a52, #3a5a7a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 79, 111, 0.3);
}

.fuc-button-container .btn-secondary {
    background: #6c757d;
    color: #ffffff;
}

.fuc-button-container .btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.fuc-button-container .btn-info {
    background: #4ECDC4;
    color: #ffffff;
}

.fuc-button-container .btn-info:hover {
    background: #2F6B7A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
}

/* Modal shell styles now provided by cls-modal.css (.cls-styled) */

.fuc-modal .modal-body p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Form Styles */
.fuc-modal .form-group {
    margin-bottom: 20px;
}

.fuc-modal .form-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 14px;
}

.fuc-modal .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #ffffff;
}

.fuc-modal .form-control:focus {
    outline: none;
    border-color: #2F4F6F;
    box-shadow: 0 0 0 3px rgba(47, 79, 111, 0.1);
}

.fuc-modal .form-control::placeholder {
    color: #adb5bd;
}

.fuc-modal select.form-control {
    height: auto;
    min-height: 46px;
    line-height: 1.5;
    padding: 10px 16px;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
}

/* Checkbox Styles */
.fuc-modal .form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-left: 0;
    position: relative;
}

.fuc-modal .form-check-input {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin: 0;
    position: relative;
    flex-shrink: 0;
    accent-color: #2F4F6F;
}

.fuc-modal .form-check-label {
    font-weight: 500;
    color: #495057;
    margin: 0;
    padding-left: 0;
    cursor: pointer;
}

/* User List Styles */
.fuc-user-list {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fuc-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 0;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.fuc-user-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.fuc-user-info {
    flex: 1;
    min-width: 0;
}

/* Actions cluster on the right side of the row — buttons sit on the same
   baseline so the remove × reads as a paired action with "Email login link"
   instead of an orphan dropped underneath. */
.fuc-user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fuc-user-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 2px;
    font-size: 15px;
}

.fuc-user-email {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 6px;
}

.fuc-user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.fuc-role-badge {
    background: linear-gradient(135deg, #2F4F6F, #3d6585);
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.fuc-remove-btn {
    /* Slightly smaller than the email button so it reads as a secondary
       action; ghost style with a soft red tint makes "remove" obvious
       without screaming for attention next to the primary navy button.
       margin-left removed — the .fuc-user-actions flex gap handles spacing. */
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.fuc-remove-btn:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.25);
}
.fuc-remove-btn:active {
    transform: translateY(1px);
}

/* "Email login link" — admin-only magic-link sender. Sized to feel like a
   small action button in the user-row, matching the navy gradient of the
   role badges so the row reads as a coherent set of UI elements. */
.fuc-magic-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #2F4F6F, #3d6585);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.fuc-magic-link-btn i {
    font-size: 11px;
    line-height: 1;
}
.fuc-magic-link-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 2px 6px rgba(47, 79, 111, 0.25);
}
.fuc-magic-link-btn:active {
    transform: translateY(1px);
}
.fuc-magic-link-btn:disabled,
.fuc-magic-link-btn.is-sending {
    opacity: 0.7;
    cursor: not-allowed;
}
.fuc-magic-link-btn.is-sent {
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

/* Last-login pill — sits under the role badges with subdued tone, picks up
   a slightly louder color when the user has never logged in so admins can
   spot dormant accounts at a glance. */
.fuc-user-last-login {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    font-size: 11.5px;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 999px;
    width: fit-content;
}
.fuc-user-last-login::before {
    content: "\f017"; /* fa-clock */
    /* "Font Awesome" first: that is what Hybrid Composer's build declares. Without it this
       clock glyph renders as an empty tofu box — same bug as the file-drawer chevron. */
    font-family: "Font Awesome", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 400;
    font-size: 10px;
    color: #94a3b8;
}
.fuc-user-last-login--never {
    color: #b45309;
    background: #fef3c7;
    border-color: #fde68a;
}
.fuc-user-last-login--never::before {
    color: #d97706;
}

/* Modal footer shell now provided by cls-modal.css (.cls-styled) */

.fuc-modal .modal-footer .btn {
    min-width: 120px;
    height: 40px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.fuc-modal .modal-footer .btn-primary {
    background: #2F4F6F;
    border-color: #2F4F6F;
}

.fuc-modal .modal-footer .btn-primary:hover {
    background: #1e3a52;
    border-color: #1e3a52;
    transform: translateY(-1px);
}

.fuc-modal .modal-footer .btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.fuc-modal .modal-footer .btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
    transform: translateY(-1px);
}

/* Loading States */
.fuc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.fuc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2F4F6F;
    border-radius: 50%;
    animation: fuc-spin 1s linear infinite;
}

@keyframes fuc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .fuc-button-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fuc-button-container .btn {
        justify-content: center;
    }
    
    .fuc-modal .modal-dialog {
        margin: 150px 1rem 1rem;
        max-width: none;
    }
    
    .fuc-modal .modal-header {
        padding: 18px 20px !important;
    }
    
    .fuc-modal .modal-body {
        padding: 20px;
    }
    
    .fuc-modal .modal-footer {
        padding: 16px 20px;
    }
    
    .fuc-user-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .fuc-remove-btn {
        align-self: flex-end;
    }
}

/* Empty State */
.fuc-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.fuc-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.fuc-empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Success/Error Messages */
.fuc-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.fuc-alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.fuc-alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Icon Styles */
.fuc-button-container .btn i {
    font-size: 16px;
}

/* Animation for modal appearance */
.fuc-modal.fade .modal-dialog {
    transform: translate(0, -50px);
    transition: transform 0.3s ease-out;
}

.fuc-modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* ==========================================================================
   Add-User UX polish: in-button spinner, toast, field reveal, input states
   ========================================================================== */

/* In-button spinner (shown while the Add User request is in flight) */
.fuc-btn-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fuc-spin 0.7s linear infinite;
}

.fuc-modal .modal-footer .btn[disabled],
.fuc-modal .modal-footer .btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

/* --- Toast notifications ------------------------------------------------- */
#fuc-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100000; /* above the modal/backdrop */
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.fuc-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(11, 72, 107, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #1f708d;
    color: #1f2d3a;
    font-size: 14px;
    line-height: 1.35;
    cursor: pointer;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.fuc-toast.fuc-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.fuc-toast.fuc-toast-hide {
    opacity: 0;
    transform: translateX(24px);
}

.fuc-toast-success { border-left-color: #1e9e5a; }
.fuc-toast-error   { border-left-color: #d64545; }

.fuc-toast-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.fuc-toast-success .fuc-toast-icon { background: #1e9e5a; }
.fuc-toast-error   .fuc-toast-icon { background: #d64545; }

.fuc-toast-body { flex: 1 1 auto; }
.fuc-toast-title { font-weight: 600; }
.fuc-toast-sub {
    margin-top: 2px;
    font-size: 13px;
    color: #5a6b78;
}

/* --- Animated field reveal (first/last/role/skip-email) ------------------ */
.fuc-revealable {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.32s ease, opacity 0.28s ease;
}

.fuc-revealable.fuc-revealed {
    max-height: 320px;
    opacity: 1;
}

/* --- Input focus + email-status icon ------------------------------------ */
.fuc-modal .form-control:focus {
    border-color: #1f708d;
    box-shadow: 0 0 0 3px rgba(31, 112, 141, 0.18);
    outline: none;
}

.fuc-email-wrap { position: relative; }

.fuc-email-status {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
}

.fuc-email-status.is-checking {
    display: flex;
    border: 2px solid #e3e8ec;
    border-top-color: #1f708d;
    border-radius: 50%;
    animation: fuc-spin 0.7s linear infinite;
}

.fuc-email-status.is-valid {
    display: flex;
    color: #1e9e5a;
    font-weight: 700;
}

/* Keep room for the status icon so text doesn't slide under it */
.fuc-email-wrap .form-control { padding-right: 38px; }

/* Matched-existing-user note shown under the email field */
.fuc-email-match {
    margin-top: 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #e8f3f7;
    border: 1px solid #bfe0ec;
    color: #0a3b52;
    font-size: 13px;
    line-height: 1.4;
}

.fuc-email-match-icon { color: #1e9e5a; flex: 0 0 auto; margin-top: 1px; }

.fuc-email-match-role {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #1f708d;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .fuc-toast { transition: opacity 0.2s ease; transform: none; }
    .fuc-toast.fuc-toast-show { transform: none; }
    .fuc-toast.fuc-toast-hide { transform: none; }
    .fuc-revealable { transition: opacity 0.2s ease; }
    .fuc-btn-spinner, .fuc-email-status.is-checking { animation-duration: 1.2s; }
}

/* 2026-10-05: Manage Users → Property page (administrators only) */
.fuc-page-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: #5d6d7e; }
.fuc-page-choice label { margin: 0; font-weight: 600; }
.fuc-page-choice select { font-size: 12px; padding: 1px 4px; height: auto; border-radius: 6px; }
.fuc-page-choice__status { font-size: 11px; }

