/* ============================================================
   USERS STYLES - Flango Café
   User Selection, Avatars, Session Banners, Sidebar
   ============================================================ */

/* ============================================================
   USER SESSION BANNER
   ============================================================ */

.user-session-banner {
    background: #f7f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

/* ============================================================
   SIDEBAR & USER INFO
   ============================================================ */

#sidebar-logo {
    width: clamp(70px, 8vw, 100px);
    height: auto;
    display: block;
    margin: 0;
}

#flango-logo-button img {
    object-fit: contain;
}

.sidebar-header-icon {
    width: clamp(32px, 5vw, 48px);
    height: clamp(32px, 5vw, 48px);
    object-fit: contain;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

#selected-user-info {
    background-color: #f0f8ff;
    border: 1px solid #d6e8f8;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: clamp(6px, 1.5vw, 10px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.info-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-box-label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
}

.info-box-value {
    font-size: clamp(14px, 1.8vw, 16px);
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.info-box-value.negative {
    color: var(--danger-color);
}

#new-balance-info {
    font-weight: 700;
    color: var(--danger-color)
}

/* ============================================================
   USER SELECTION
   ============================================================ */

#user-selection-area {
    border-top: 2px solid #eee;
    padding-top: clamp(4px, 1vw, 8px);
    padding-bottom: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vw, 8px);
}

#select-customer-main-btn {
    background-color: var(--warning-color);
    color: #fff;
    padding: clamp(10px, 2vw, 16px);
    font-size: clamp(16px, 1.8vw, 18px);
    font-family: var(--font-body);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 0;
}

#user-selection-actions {
    display: flex;
    gap: clamp(6px, 1.5vw, 12px);
    align-items: stretch;
}

#user-selection-actions button {
    flex: 1;
}

/* ============================================================
   AVATAR PICKER
   ============================================================ */

.avatar-carousel-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding-bottom: 15px;
}

#avatar-picker-scroll-wrapper {
    overflow-y: auto;
    flex-grow: 1;
    padding: 15px 10px 0 10px;
    margin: 0 -10px;
}

#avatar-picker-modal .modal-content {
    max-width: 850px;
}

.avatar-row {
    position: relative;
}

.avatar-row-header {
    background: linear-gradient(135deg, #f8fbff, #fef9f3);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.07);
}

.avatar-row-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    line-height: 1.4;
}

.avatar-row-description {
    font-size: 14px;
    color: #475569;
    font-weight: 400;
    font-family: var(--font-body);
    margin: -4px 0 8px;
    padding-left: 10px;
    max-width: 560px;
}

.avatar-row.locked .avatar-scroller {
    filter: grayscale(90%) brightness(0.8);
}

.avatar-row-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border-radius: 12px;
    color: #4a3c5b;
    text-align: center;
}

.avatar-lock-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.avatar-row.locked .avatar-lock-overlay {
    display: flex;
}

.avatar-lock-overlay img {
    width: 40px;
    height: 40px;
    opacity: 0.8;
}

.avatar-lock-overlay.shake {
    animation: shake-animation 0.4s ease-in-out;
}

.avatar-scroller {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.avatar-scroller::-webkit-scrollbar {
    display: none;
}

.avatar-row-nav {
    position: absolute;
    top: 50%;
    transform: translateY(50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #e5e5e5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-row-nav.left {
    left: 15px;
}

.avatar-row-nav.right {
    right: 15px;
}

.avatar-carousel-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.avatar-scroller-viewport {
    width: 645px;
    overflow: hidden;
}

.avatar-option {
    border-radius: 12px;
    position: relative;
    background-color: #f0f0f0;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    border: 3px solid transparent;
    flex-shrink: 0;
    width: 200px;
    height: 200px;
}

.avatar-option.selected {
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25), 0 10px 18px rgba(16, 185, 129, 0.45);
    transform: translateY(-2px);
    outline: 3px solid rgba(34, 197, 94, 0.6);
}

.avatar-option.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #22c55e;
    color: white;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.45);
    z-index: 3;
}

.avatar-row.locked .avatar-option {
    cursor: not-allowed;
}

.avatar-option:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.avatar-preview-btn:hover {
    background: #fff;
}

.avatar-preview-full {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.avatar-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.avatar-preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.avatar-preview-content .close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: #333;
    border: none;
    font-size: 28px;
    line-height: 1;
}

.avatar-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.8);
    font-size: 32px;
    cursor: pointer;
}

.avatar-preview-nav.prev {
    left: -60px;
}

.avatar-preview-nav.next {
    right: -60px;
}

#logged-in-user-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--secondary-color);
    transition: transform 0.2s ease;
}

.user-info-cluster:hover #logged-in-user-avatar {
    transform: translateY(-1px);
}

#logged-in-user-avatar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes shake-animation {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(calc(var(--shake-distance, 4px) * -1));
    }
    40%, 80% {
        transform: translateX(var(--shake-distance, 4px));
    }
}

@keyframes lockFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
}
