/* ================================================
   HAND VIEW (Extra Work / Raise Hand Map UI)
   ================================================ */

#hand-view {
    position: fixed;
    inset: 0;
    z-index: 500;
    pointer-events: none;
}

/* === Top Header Card === */
#hand-sidebar {
    position: absolute;
    top: 20px;
    /* Center aligning for mobile */
    left: 50%;
    transform: translateX(-50%);
    width: min(500px, calc(100vw - 40px));
    max-height: calc(100vh - 160px);
    background: white;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* entry-point animation */
    animation: handCardIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    transition: box-shadow 0.3s;
}

#hand-sidebar.minimized {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Tablet / PC: Left aligned */
@media (min-width: 768px) {
    #hand-sidebar {
        left: 20px;
        transform: none;
        width: 320px;
        animation: handCardInDesktop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    }
}

/* Mobile Animation (preserves centering) */
@keyframes handCardIn {
    from {
        opacity: 0;
        transform: translate(-50%, -8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

/* Desktop Animation (no centering needed) */
@keyframes handCardInDesktop {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.hand-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.hand-sidebar-header h2 {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #94a3b8;
    text-transform: uppercase;
    margin: 0;
}

/* Red Badge */
.hand-badge {
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Toggle Caret Button */
.hs-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.hs-toggle-btn svg {
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#hand-sidebar.minimized .hs-toggle-btn svg {
    transform: rotate(-180deg);
}

#hand-view-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

#hand-view-back-btn:hover {
    background: #f1f5f9;
}

/* === Grid Wrapper for Smooth Minimize Animation === */
#hand-sidebar-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#hand-sidebar.minimized #hand-sidebar-body {
    grid-template-rows: 0fr;
}

#hand-sidebar-list {
    min-height: 0;
    overflow-y: auto;
    padding: 6px 0;
    transition: opacity 0.2s;
}

#hand-sidebar.minimized #hand-sidebar-list {
    opacity: 0;
    pointer-events: none;
    padding: 0;
}

.hand-sidebar-no-entries {
    padding: 36px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: opacity 0.2s;
}

#hand-sidebar.minimized .hand-sidebar-no-entries {
    opacity: 0;
    pointer-events: none;
}

.hand-sidebar-no-entries .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
    opacity: 0.8;
}

/* === Hand entry row === */
.hand-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 0;
}

.hand-sidebar-item:hover {
    background: #f8fafc;
}

.hand-sidebar-item .hs-icon {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

/* Orange tint = my session */
.hand-sidebar-item.hs-mine .hs-icon {
    filter: sepia(1) saturate(5) hue-rotate(350deg) brightness(1.05);
}

/* Blue tint = others */
.hand-sidebar-item.hs-other .hs-icon {
    filter: sepia(1) saturate(5) hue-rotate(190deg) brightness(1.05);
}

.hand-sidebar-item .hs-info {
    flex: 1;
    min-width: 0;
}

.hand-sidebar-item .hs-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}

.hand-sidebar-item .hs-lab {
    font-size: 0.68rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.hs-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    font-size: 1rem;
    padding: 4px 8px;
    flex-shrink: 0;
    transition: color 0.15s;
    line-height: 1;
}

.hs-remove-btn:hover {
    color: #94a3b8;
}

/* === Bottom Search Container === */
#hand-search-container {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: min(500px, calc(100vw - 32px));
    /* Wider on mobile to match reference */
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 24px;
}

/* The pill — bottom centered */
#hand-search-pill {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 999px;
    padding: 0 20px;
    height: 52px;
    width: 100%;
    gap: 12px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
    pointer-events: auto;
    z-index: 2;
}

#hand-search-pill:focus-within {
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(0, 0, 0, 0.1);
}

.hand-search-curve-accent {
    position: fixed;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 40px;
    background: white;
    border-radius: 40px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1;
    pointer-events: none;
}

/* Monochromatic search icon (inline SVG) */
.hand-search-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #9aa0a6;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hand-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: 'Inter', system-ui, sans-serif;
    background: transparent;
    color: #202124;
    min-width: 0;
    line-height: normal;
    /* Fix vertical alignment */
    height: 100%;
    /* Fill the pill vertically */
    padding: 0;
}

#hand-search-input::placeholder {
    color: #9aa0a6;
    font-weight: 400;
}

/* Clear (X) button inside pill */
#hand-search-clear {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #9aa0a6;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

#hand-search-clear:hover {
    background: #f1f5f9;
    color: #374151;
}

/* === Results Dropdown === */
#hand-search-results {
    margin-bottom: 12px;
    background: #fff;
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.16),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    max-height: 40vh;
    width: 100%;
    overflow-y: auto;
    display: none;
    pointer-events: auto;
    /* Entry animation from bottom up */
    animation: resultsUp 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes resultsUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#hand-search-results.has-results {
    display: block;
}

.hsr-lab-header {
    padding: 6px 16px 3px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #9aa0a6;
    text-transform: uppercase;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 1;
}

.hsr-student-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    gap: 12px;
    transition: background 0.1s;
}

.hsr-student-row:hover {
    background: #f8fafc;
}

.hsr-student-row.already-nominated {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.hsr-student-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 1;
    color: #111827;
}

.hsr-nominate-btn {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2563eb;
    background: #eff6ff;
    border: none;
    flex-shrink: 0;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    letter-spacing: 0.01em;
    transition: background 0.15s;
}

.hsr-nominate-btn:hover {
    background: #dbeafe;
}

/* ==== Dark Mode ==== */
[data-theme="dark"] #hand-sidebar {
    background: rgba(17, 24, 39, 0.97);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .hand-sidebar-header {
    border-bottom-color: #1f2937;
}

[data-theme="dark"] .hand-sidebar-item:hover {
    background: #1f2937;
}

[data-theme="dark"] .hand-sidebar-item .hs-name {
    color: #f9fafb;
}

[data-theme="dark"] .hand-sidebar-item .hs-lab {
    color: #9ca3af;
}

[data-theme="dark"] #hand-search-pill,
[data-theme="dark"] #hand-search-results {
    background: #1f2937;
}

[data-theme="dark"] #hand-search-input {
    color: #f9fafb;
}

[data-theme="dark"] .hand-search-icon {
    color: #6b7280;
}

[data-theme="dark"] .hsr-lab-header {
    background: #111827;
    border-bottom-color: #1f2937;
    color: #6b7280;
}

[data-theme="dark"] .hsr-student-row:hover {
    background: #1e3a5f;
}

[data-theme="dark"] .hsr-student-name {
    color: #f9fafb;
}

[data-theme="dark"] #hand-view-back-btn {
    color: #9ca3af;
}

[data-theme="dark"] #hand-view-back-btn:hover {
    background: #1f2937;
}