/* Notification overlay — modal */
.notification-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    display: none; align-items: center; justify-content: center; z-index: 400; padding: 16px;
}
.notification-overlay.active { display: flex; }
/* max-width also caps consumers' fixed-width overrides (.notification-box { width: 500px } etc.) so
   the dialog never runs off a phone screen; max-height + scroll keeps long messages reachable. */
.notification-box {
    background: var(--color-card-bg); border-radius: 20px; padding: 36px 32px;
    width: 100%; max-width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5); border: 2px solid #444; backdrop-filter: blur(10px);
}
.notification-box.success {
    background: linear-gradient(135deg, rgba(34,197,94,0.85), rgba(22,163,74,0.75));
    border-color: rgba(34,197,94,0.6);
}
.notification-box.error {
    background: linear-gradient(135deg, rgba(220,38,38,0.85), rgba(185,28,28,0.75));
    border-color: rgba(220,38,38,0.6);
}
.notification-icon {
    width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 26px;
}
.notification-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.notification-box.success .notification-title { color: #86efac; }
.notification-box.error .notification-title   { color: #fca5a5; }
.notification-message {
    font-size: 14px; color: rgba(255,255,255,0.85); margin-bottom: 24px;
    line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere;
}
.notification-box, .rack-modal { overflow-wrap: anywhere; }
.notification-box button {
    margin-top: 4px; padding: 10px 32px; background: rgba(255,255,255,0.2);
    color: #fff; border: 1px solid rgba(255,255,255,0.35); border-radius: 100px;
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background 0.2s;
}
.notification-box button:hover { background: #031E3B; }

/* Non-modal alert toast stack */
.alert-toast-stack {
    position: fixed; top: 16px; right: 16px; z-index: 420;
    display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none;
}
.alert-toast {
    pointer-events: auto;
    background: linear-gradient(135deg, rgba(220,38,38,0.92), rgba(185,28,28,0.88));
    color: #fff; border: 1px solid rgba(252,165,165,0.5); border-radius: 14px;
    padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
}
.alert-toast.fade { opacity: 0; transform: translateX(8px); }
.alert-toast .at-title {
    font-weight: 700; font-size: 14px; color: #fff5f5; margin-bottom: 4px;
    display: flex; align-items: center; gap: 8px;
}
.alert-toast .at-title .at-icon {
    width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.25);
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
}
.alert-toast .at-message { font-size: 13px; color: rgba(255,255,255,0.95); line-height: 1.4; word-wrap: break-word; }
.alert-toast .at-meta { font-size: 11px; color: rgba(255,255,255,0.75); margin-top: 6px; font-family: Consolas, monospace; }
.alert-toast .at-dismiss-hint { font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 8px; text-align: right; }

/* Rack/folder picker overlay */
.rack-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center; z-index: 380; padding: 24px;
}
.rack-overlay.active { display: flex; }
#folderPickerOverlay {
    background: rgba(8,8,12,0.55); backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    animation: folderPickerBackdropIn 0.18s ease-out both;
}
#folderPickerOverlay > * { animation: folderPickerScaleIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; transform-origin: center center; }
@keyframes folderPickerBackdropIn { from { background: rgba(8,8,12,0); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); } }
@keyframes folderPickerScaleIn { from { transform: scale(0.86); opacity: 0; } 60% { transform: scale(1.02); opacity: 1; } to { transform: scale(1); opacity: 1; } }
.rack-modal {
    background: var(--color-card-bg); border-radius: 20px; padding: 28px 28px 24px;
    width: 100%; height: 100%; max-width: none; max-height: none;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6); border: 2px solid #444;
    display: flex; flex-direction: column; gap: 16px;
}
.rack-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.rack-title { font-size: 20px; font-weight: 700; color: var(--color-accent); }
.rack-sub { font-size: 13px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.rack-refresh { background: var(--color-primary); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.rack-refresh:hover { background: #2d5fa1; }
.rack-grid { display: grid; gap: 6px; flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px; background: rgba(255,255,255,0.03); border-radius: 10px; }
#rackGridSlot { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
#rackGridSlot > .rack-grid { flex: 1 1 auto; min-height: 0; }
#rackGridSlot > :not(.rack-grid) { flex: 0 0 auto; }
.rack-cell { aspect-ratio: 1 / 0.7; display: flex; align-items: center; justify-content: center; text-align: center; font-family: inherit; font-size: 12px; font-weight: 600; padding: 4px; border-radius: 6px; overflow: hidden; word-break: break-all; line-height: 1.1; user-select: none; min-width: 0; min-height: 0; }
.rack-grid .rack-cell { aspect-ratio: auto; height: 100%; width: 100%; }
.rack-cell.empty { background: rgba(255,255,255,0.04); border: 1px dashed rgba(255,255,255,0.18); color: rgba(255,255,255,0.35); cursor: default; }
.rack-cell.available { background: rgba(34,197,94,0.35); border: 1px solid rgba(34,197,94,0.65); color: #fff; cursor: pointer; transition: background 0.1s, border-color 0.1s, transform 0.06s; }
.rack-cell.available:hover { background: rgba(254,190,16,0.5); border-color: var(--color-accent); color: var(--color-card-bg); }
.rack-cell.available:active { transform: scale(0.97); }
.rack-cell.occupied { background: rgba(220,38,38,0.45); border: 1px solid rgba(220,38,38,0.7); color: rgba(255,255,255,0.85); cursor: not-allowed; opacity: 0.85; }
.rack-cell.unknown { background: rgba(120,120,120,0.45); border: 1px solid rgba(180,180,180,0.5); color: rgba(255,255,255,0.85); cursor: pointer; }
.rack-cell.unknown:hover { background: rgba(254,190,16,0.5); border-color: var(--color-accent); color: var(--color-card-bg); }
.rack-fallback { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); gap: 10px; max-height: 55vh; overflow-y: auto; padding: 4px; }
.rack-tile { background: rgba(34,197,94,0.2); border: 1px solid rgba(34,197,94,0.5); border-radius: 10px; padding: 12px; cursor: pointer; transition: background 0.1s, border-color 0.1s; text-align: left; font-family: inherit; color: #fff; }
.rack-tile:hover:not(:disabled) { background: rgba(254,190,16,0.5); border-color: var(--color-accent); color: var(--color-card-bg); }
.rack-tile-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.rack-tile-detail { font-size: 11px; color: rgba(255,255,255,0.6); font-family: Consolas, monospace; }
.rack-legend { display: flex; gap: 14px; font-size: 11px; color: rgba(255,255,255,0.7); justify-content: center; flex-wrap: wrap; }
.rack-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rack-legend .swatch.available { background: rgba(34,197,94,0.5); border: 1px solid rgba(34,197,94,0.7); }
.rack-legend .swatch.occupied  { background: rgba(220,38,38,0.5); border: 1px solid rgba(220,38,38,0.7); }
.rack-legend .swatch.unknown   { background: rgba(120,120,120,0.5); border: 1px solid rgba(180,180,180,0.5); }
.rack-actions { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.12); }
.rack-do-not-move { background: #dc2626 !important; color: #fff !important; height: auto !important; padding: 12px 24px; }
.rack-do-not-move:hover { background: #b91c1c !important; }
.rack-footnote { font-size: 12px; color: rgba(255,255,255,0.55); }
.rack-empty { text-align: center; padding: 28px; color: rgba(255,255,255,0.6); font-style: italic; grid-column: 1 / -1; }


