﻿/* =========================================================
   HPF Account Switcher
   File: wwwroot/css/account-switcher.css
   ========================================================= */

/* Prevent page scrolling while the modal is open */
body.account-switcher-open {
    overflow: hidden;
}

/* Overlay */
.account-switcher-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(12, 22, 30, 0.68);
}

    .account-switcher-overlay[hidden] {
        display: none !important;
    }

/* Main dialog */
.account-switcher-dialog {
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #c8d1d8;
    border-top: 6px solid #356b1f;
    border-radius: 10px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
}

/* Header */
.account-switcher-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 30px 20px;
    border-bottom: 1px solid #d9e0e5;
}

    .account-switcher-header h2 {
        margin: 0;
        color: #123f68;
        font-size: 34px;
        font-weight: 700;
        line-height: 1.15;
    }

    .account-switcher-header p {
        margin: 8px 0 0;
        color: #5a6874;
        font-size: 17px;
        line-height: 1.45;
    }

    .account-switcher-header strong {
        color: #263746;
    }

/* Close button */
.account-switcher-close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #edf1f4;
    color: #4b5965;
    font-size: 27px;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

    .account-switcher-close:hover {
        background: #dfe5e9;
        color: #172633;
    }

    .account-switcher-close:focus {
        outline: 3px solid rgba(53, 107, 31, 0.25);
        outline-offset: 2px;
    }

/* Account list */
.account-switcher-list {
    display: grid;
    gap: 14px;
    padding: 22px 30px;
}

.account-switch-form {
    margin: 0;
}

/* Individual account card */
.account-switch-card {
    width: 100%;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 2px solid #c7d8e5;
    border-radius: 10px;
    background: #f8fbfd;
    color: #263746;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

    .account-switch-card:hover:not(:disabled) {
        border-color: #7da8c7;
        background: #f0f7fb;
        box-shadow: 0 5px 14px rgba(28, 74, 107, 0.12);
        transform: translateY(-1px);
    }

    .account-switch-card:focus {
        outline: 3px solid rgba(53, 107, 31, 0.25);
        outline-offset: 2px;
    }

    /* Current account */
    .account-switch-card.current {
        border-color: #52a269;
        background: #eaf5ed;
        cursor: default;
    }

        .account-switch-card.current:hover {
            transform: none;
            box-shadow: none;
        }

    .account-switch-card:disabled {
        opacity: 1;
    }

/* Avatar */
.account-switch-avatar {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #3478b8;
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
}

    /*
 Optional variations.
 Add one of these classes from Razor based on account type.
*/
    .account-switch-avatar.state {
        background: #3478b8;
    }

    .account-switch-avatar.tribe {
        background: #b96f21;
    }

    .account-switch-avatar.local-government {
        background: #7955b3;
    }

    .account-switch-avatar.nonprofit {
        background: #5f8f57;
    }

    .account-switch-avatar.administrator {
        background: #245a87;
    }

/* Account information */
.account-switch-information {
    min-width: 0;
    display: block;
}

.account-switch-name {
    display: block;
    overflow-wrap: anywhere;
    color: #123f68;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.account-switch-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 8px;
    color: #556573;
    font-size: 14px;
}

/* Role badge */
.account-role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 14px;
    background: #dceaf6;
    color: #123f68;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Current/default badges */
.account-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 14px;
    background: #dff1e3;
    color: #26743c;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Arrow/check on right */
.account-switch-arrow {
    color: #7797ae;
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
}

.account-switch-card.current .account-switch-arrow {
    color: #4d9b64;
}

/* Informational footer */
.account-switcher-note {
    margin: 0 30px 28px;
    padding: 13px 15px;
    border: 1px solid #d9e0e5;
    border-left: 4px solid #356b1f;
    border-radius: 5px;
    background: #f6f8f9;
    color: #53616d;
    font-size: 14px;
    line-height: 1.45;
}

/* Empty state */
.account-switcher-empty {
    padding: 30px 20px;
    border: 1px dashed #bcc7cf;
    border-radius: 8px;
    background: #f8fafb;
    color: #596875;
    text-align: center;
}

/* Header trigger button */
.account-switcher-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.12);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .account-switcher-trigger:hover {
        border-color: rgba(255, 255, 255, 0.65);
        background: rgba(0, 0, 0, 0.24);
        color: #ffffff;
        text-decoration: none;
    }

    .account-switcher-trigger:focus {
        outline: 3px solid rgba(255, 255, 255, 0.28);
        outline-offset: 2px;
    }

/* Container for switch and logoff buttons */
.account-context-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Loading state used while a switch request is processing */
.account-switch-card.is-switching {
    pointer-events: none;
    opacity: 0.7;
}

    .account-switch-card.is-switching .account-switch-arrow {
        animation: account-switcher-pulse 0.8s ease-in-out infinite alternate;
    }

@keyframes account-switcher-pulse {
    from {
        opacity: 0.35;
    }

    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .account-switcher-overlay {
        align-items: flex-start;
        padding: 12px;
        overflow-y: auto;
    }

    .account-switcher-dialog {
        max-height: none;
        margin: 18px 0;
        border-radius: 8px;
    }

    .account-switcher-header {
        padding: 22px 18px 16px;
    }

        .account-switcher-header h2 {
            font-size: 27px;
        }

        .account-switcher-header p {
            font-size: 15px;
        }

    .account-switcher-list {
        padding: 18px;
    }

    .account-switch-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 13px;
        padding: 16px;
    }

    .account-switch-avatar {
        width: 46px;
        height: 46px;
        font-size: 19px;
    }

    .account-switch-name {
        font-size: 19px;
    }

    .account-switch-arrow {
        display: none;
    }

    .account-switcher-note {
        margin: 0 18px 22px;
    }

    .account-context-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .account-switcher-overlay {
        padding: 0;
    }

    .account-switcher-dialog {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .account-switcher-header {
        padding-top: 20px;
    }

    .account-switch-card {
        align-items: flex-start;
    }

    .account-switch-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .account-switcher-close {
        width: 36px;
        height: 36px;
    }
}

/* Reduced-motion support */
@media (prefers-reduced-motion: reduce) {
    .account-switch-card,
    .account-switcher-close,
    .account-switcher-trigger {
        transition: none;
    }

        .account-switch-card.is-switching .account-switch-arrow {
            animation: none;
        }
}
