/* assignment-cloud.css - styling + animations for the drag/drop cloud canvas */

.cloud-root {
    width: 100%;
    height: calc(100vh - 210px);
    min-height: 480px;
}

.cloud-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 1px solid #d5dbe0;
    border-radius: 10px;
    background:
        radial-gradient(circle, #e7ecf1 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(180deg, #fbfcfe 0%, #f1f4f8 100%);
    cursor: grab;
    touch-action: none;
    /* prevent stray text selection while dragging/panning (breaks pointer events) */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* the filter box must still be selectable/editable */
.cloud-filter-input {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.cloud-viewport.panning {
    cursor: grabbing;
}

.cloud-world {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    width: 2000px;
    height: 1200px;
}

/* Fixed Unassigned sidebar: stays put while the world pans/zooms. */
.cloud-sidebar {
    position: absolute;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: 300px;
    min-width: 210px;
    max-width: 620px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    resize: horizontal;
    overflow: hidden;
}

.cloud-sidebar .cloud-zone-pool {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    box-shadow: 0 6px 22px rgba(30, 50, 80, 0.18);
}

.cloud-sidebar .cloud-zone-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none; /* fill the sidebar height */
    overflow-y: auto;
}

/* Top-level draggable unit (pool, a group, or a standalone cloud). */
.cloud-unit {
    position: absolute;
    left: 0;
    top: 0;
}

.cloud-unit-dragging {
    z-index: 500;
    box-shadow: 0 14px 34px rgba(30, 50, 80, 0.32) !important;
    cursor: grabbing;
}

/* springy glide into place for Reset view / Circle layout */
.cloud-unit.cloud-springing {
    transition: left 560ms cubic-bezier(0.34, 1.56, 0.64, 1),
                top 560ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cloud-world.cloud-springing {
    transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* fade/scale out when a panel is dismissed */
.cloud-leaving {
    animation: cloud-leave 300ms ease forwards;
    transform-origin: center;
    pointer-events: none;
}

/* pop back in when restored / shown */
.cloud-zone-appear {
    animation: cloud-pop-in 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes cloud-leave {
    to { opacity: 0; transform: scale(0.82); }
}

/* Header/title acts as a drag handle for moving a cloud around. */
.cloud-drag-handle {
    cursor: grab;
}

/* Ctrl/Cmd + drag rubber-band selection */
.cloud-marquee {
    position: absolute;
    z-index: 45;
    border: 1.5px dashed #2b6cb0;
    background: rgba(43, 108, 176, 0.1);
    border-radius: 4px;
    pointer-events: none;
}

/* a panel that's part of the current group selection */
.cloud-unit-selected {
    outline: 2px solid #2b6cb0;
    outline-offset: 2px;
    border-radius: 12px;
}

.cloud-unit-selected .cloud-zone,
.cloud-unit-selected.cloud-zone {
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.25), 0 2px 6px rgba(30, 50, 80, 0.08);
}

/* ---- groups (options that share a base name) ---- */
.cloud-group {
    border: 1.5px dashed #9db2c7;
    border-radius: 14px;
    padding: 6px 14px 14px;
    background: rgba(120, 150, 190, 0.07);
    animation: cloud-fade-in 260ms ease both;
}

.cloud-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    color: #40566e;
    margin: 0 2px 10px;
    padding: 6px 2px;
    text-transform: uppercase;
}

.cloud-group-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
}

/* ---- individual drop zone (a "cloud") ---- */
.cloud-zone {
    background: #ffffff;
    border: 1px solid #d9e0e7;
    border-radius: 12px;
    min-width: 170px;
    width: 210px;
    box-shadow: 0 2px 6px rgba(30, 50, 80, 0.08);
    animation: cloud-fade-in 260ms ease both;
    transition: box-shadow 160ms ease, transform 160ms ease;
}

/* Panels can be widened (drag the bottom-right grip) so long labels aren't cut off. */
.cloud-zone-resizable {
    resize: horizontal;
    overflow: hidden;
}

.cloud-zone-pool {
    border-color: #b9c4d0;
    background: #f7f9fc;
    min-width: 240px;
    width: 300px;
}

.cloud-zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid #eef1f5;
    font-weight: 600;
    color: #2b3a4b;
}

.cloud-zone-pool .cloud-zone-header {
    color: #55647a;
}

.cloud-zone-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cloud-zone-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    margin-left: 8px;
}

.cloud-zone-count {
    min-width: 24px;
    text-align: center;
    background: #2b6cb0;
    color: #fff;
    border-radius: 11px;
    padding: 1px 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* dismiss (hide) button on each cloud / group */
.cloud-dismiss {
    border: none;
    background: transparent;
    color: #9aa7b5;
    font-size: 1.05rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    border-radius: 5px;
    transition: color 120ms ease, background-color 120ms ease;
}

.cloud-dismiss:hover {
    color: #c0392b;
    background: rgba(192, 57, 43, 0.1);
}

.cloud-zone-body {
    padding: 10px;
    min-height: 54px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-content: flex-start;
    transition: background-color 140ms ease;
}


.cloud-zone-filter {
    padding: 8px 10px 0;
}

.cloud-filter-input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 9px;
    border: 1px solid #cdd6e0;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: text;
}

.cloud-filter-input:focus {
    outline: none;
    border-color: #2b6cb0;
    box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.18);
}

.cloud-chip-filtered {
    display: none !important;
}

.cloud-zone-body-over {
    background: rgba(43, 108, 176, 0.12);
    box-shadow: inset 0 0 0 2px rgba(43, 108, 176, 0.5);
    border-radius: 8px;
}

/* ---- chips ---- */
.cloud-chip {
    background: linear-gradient(180deg, #ffffff 0%, #eef3f9 100%);
    border: 1px solid #c6d2df;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.85rem;
    color: #223247;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(30, 50, 80, 0.12);
    transition: box-shadow 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.cloud-chip:hover {
    box-shadow: 0 3px 8px rgba(30, 50, 80, 0.2);
    transform: translateY(-1px);
}

.cloud-chip-dragging {
    opacity: 0.35;
    filter: grayscale(0.3);
}

/* richer chip with age/type and preference tags (Positions page) */
.cloud-chip-rich {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    border-radius: 10px;
    padding: 6px 10px;
    white-space: normal;
    max-width: 240px;
}

.cloud-chip-name {
    font-weight: 600;
}

.cloud-chip-meta {
    font-size: 0.72rem;
    color: #5b6a7d;
}

.cloud-chip-prefs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 1px;
}

.cloud-chip-pref {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef3fb;
    border: 1px solid #d3e0f0;
    border-radius: 999px;
    padding: 1px 7px 1px 2px;
    font-size: 0.68rem;
    color: #2b4a72;
    max-width: 100%;
}

.cloud-chip-pref-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2b6cb0;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    flex: 0 0 auto;
}

/* floating clone that follows the pointer */
.cloud-chip-ghost {
    position: fixed;
    z-index: 3000;
    pointer-events: none;
    margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #e3ecf7 100%);
    border-color: #2b6cb0;
    box-shadow: 0 10px 22px rgba(30, 50, 80, 0.32);
    transform: scale(1.06) rotate(-2deg);
    animation: cloud-grab 140ms ease both;
}

/* floating clone that flies from source to destination on assign/move */
.cloud-chip-fly {
    position: fixed;
    z-index: 3000;
    pointer-events: none;
    margin: 0;
    background: linear-gradient(180deg, #ffffff 0%, #e3ecf7 100%);
    border: 1px solid #2b6cb0;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.85rem;
    color: #223247;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(30, 50, 80, 0.3);
}

/* little bounce when a dragged chip lands */
.cloud-chip-landed {
    animation: cloud-land 360ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

/* new chip fades/pops in */
.cloud-chip-appear {
    animation: cloud-pop-in 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

/* highlight when moved by someone else */
.cloud-chip-external {
    animation: cloud-external 1.5s ease both;
}

/* count badge pop */
.cloud-count-pop {
    animation: cloud-count 380ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

@keyframes cloud-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes cloud-grab {
    from { transform: scale(1) rotate(0deg); }
    to   { transform: scale(1.06) rotate(-2deg); }
}

@keyframes cloud-land {
    0%   { transform: scale(1.18); box-shadow: 0 8px 18px rgba(43,108,176,0.4); }
    60%  { transform: scale(0.94); }
    100% { transform: scale(1); }
}

@keyframes cloud-pop-in {
    0%   { opacity: 0; transform: scale(0.4); }
    70%  { opacity: 1; transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes cloud-external {
    0%   { background: #fff6cc; border-color: #e0a800; box-shadow: 0 0 0 3px rgba(224,168,0,0.4); }
    100% { background: linear-gradient(180deg, #ffffff 0%, #eef3f9 100%); border-color: #c6d2df; box-shadow: 0 1px 2px rgba(30,50,80,0.12); }
}

@keyframes cloud-count {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.45); background: #1f5a95; }
    100% { transform: scale(1); }
}

/* toolbar above the canvas */
.cloud-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cloud-hint {
    color: #6b7887;
    font-size: 0.85rem;
}

/* loading overlay while the canvas is first populated */
.cloud-stage {
    position: relative;
}

.cloud-loading {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(247, 249, 252, 0.72);
    border-radius: 10px;
}

.cloud-loading-box {
    display: flex;
    align-items: center;
    gap: 11px;
    background: #fff;
    border: 1px solid #d5dbe0;
    border-radius: 10px;
    padding: 14px 22px;
    box-shadow: 0 8px 24px rgba(30, 50, 80, 0.16);
    font-weight: 600;
    color: #40566e;
}

.cloud-loading-box i {
    color: #2b6cb0;
    font-size: 1.25rem;
}

/* per-item restore menu */
.cloud-hidden-menu {
    position: relative;
    display: inline-block;
}

.cloud-hidden-dropdown {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-width: 360px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d5dbe0;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(30, 50, 80, 0.22);
    padding: 6px;
    animation: cloud-fade-in 140ms ease both;
}

.cloud-hidden-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #223247;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cloud-hidden-item:hover {
    background: rgba(43, 108, 176, 0.1);
}

.cloud-hidden-item i {
    color: #6b7887;
    margin-right: 6px;
}

.cloud-hidden-sep {
    height: 1px;
    background: #eef1f5;
    margin: 5px 4px;
}

.cloud-hidden-all {
    font-weight: 600;
    color: #2b6cb0;
}
